API

pcdsutils.enum

pcdsutils.enum.CaseInsensitiveEnumMeta(cls, ...)

pcdsutils.enum.HelpfulIntEnum(...[, module, ...])

IntEnum subclass with some utility extensions and case insensitivity.

pcdsutils.ext_scripts

pcdsutils.ext_scripts.cache_script(args[, ...])

pcdsutils.ext_scripts.call_script(args[, ...])

Helper script for external script error handling and logging.

pcdsutils.ext_scripts.clear_script_cache()

pcdsutils.ext_scripts.get_ami_proxy(hutch[, ...])

Call procmgr to determine the lcls-I ami proxy hostname.

pcdsutils.ext_scripts.get_current_experiment([...])

Call get_curr_exp to return the current experiment name.

pcdsutils.ext_scripts.get_hutch_name([timeout])

Call get_hutch_name to return the name of the current hutch.

pcdsutils.ext_scripts.get_run_number([...])

Call get_lastRun to return the run number of the last daq run.

pcdsutils.import_timer

pcdsutils.import_timer.ImportTimeStats(...)

Stats about importing this module or submodule.

pcdsutils.import_timer.ModuleStatsSummary(...)

For a top-level module, the total time spent on all the submodules.

pcdsutils.import_timer.display_summarized_import_stats(...)

Show a prettytable summary of all the import statistics.

pcdsutils.import_timer.get_import_chain(...)

For a given import, figure out why a specific submodule is being imported.

pcdsutils.import_timer.get_import_stats(module)

Get the import time statistics for a given module.

pcdsutils.import_timer.get_import_time_text(module)

Run python -X importtime modulename in a subprocess.

pcdsutils.import_timer.interpret_import_time(stats)

Summarize the results of the import time checker in an understandable way.

pcdsutils.import_timer.main(module[, ...])

pcdsutils.import_timer.summarize_import_stats(module)

Summarize the import time statistics for a given module.

pcdsutils.info

pcdsutils.info.Experiment(valid, name, ...)

Experiment information.

pcdsutils.info.Instrument(hutch, daq_base, ...)

Per-instrument information.

pcdsutils.info.ProgramArguments([hutch, ...])

Argparse arguments for get-info-json.

pcdsutils.info.Run(valid, live, num, type, ...)

Run information.

pcdsutils.info.RunFiles(valid, files, num_files)

For a given run, information about the files generated.

pcdsutils.info._LogbookInfo([valid])

Base dataclass to help with retrieving logbook information and transforming it into a dataclass.

pcdsutils.info.fix_hutch_name(hutch)

Fix a user-provided hutch name.

pcdsutils.info.get_hutch_by_hostname([hostname])

Given a hostname, get a hutch name.

pcdsutils.info.get_info(args)

Get top-level Instrument information given args.

pcdsutils.info.is_monitor_host(hostname)

Is hostname a monitor host?

pcdsutils.info.main()

Main entrypoint for get-info-json.

pcdsutils.json_to_table

pcdsutils.json_to_table.ProgramArguments(...)

Argparse arguments for json_to_table.

pcdsutils.json_to_table.TableStyle(*values)

Table style/format to print.

pcdsutils.json_to_table.main(args)

pcdsutils.json_to_table.string_for_table(value)

Fix the value for display in the table.

pcdsutils.json_to_table.table_from_json(...)

Create a PrettyTable from the input JSON data.

pcdsutils.log

pcdsutils.log.DemotionFilter([level, ...])

Filter parent class for demoting log records.

pcdsutils.log.LogWarningLevelFilter([level, ...])

Filter to decrease the log level of repeat warnings.

pcdsutils.log.OphydCallbackExceptionDemoter([...])

Filter that demotes the logging level of callback exceptions.

pcdsutils.log.OphydObjectRecordInfo(message, ...)

Hashable collection of the unique information from an ophyd.objects log

pcdsutils.log.PydmDemotionFilter([level, ...])

Demote verbose logs from pydm, particulary those that come at exit.

pcdsutils.log.RecordInfo(message)

Parent dataclass to define the interface for DemotionFilter

pcdsutils.log.WarningRecordInfo(message, ...)

Hashable collection of the unique information from a warnings.warn call.

pcdsutils.log._JsonLogQueueHandler(*handlers)

Logging handler which pushes `logging.LogRecord`s to a separate thread

pcdsutils.log._LogQueueListener(queue, *handlers)

A log handler which listens in a separate thread for queued records

pcdsutils.log._PassthroughDatagramHandler(...)

pcdsutils.log._PassthroughStreamHandler(...)

pcdsutils.log.centralized_logging_enabled()

Returns True if centralized logging should be enabled.

pcdsutils.log.configure_pcds_logging([file, ...])

Set a new handler on the logging.getLogger('pcds-logging') logger.

pcdsutils.log.create_log_dictionary_from_record(record)

Create a PCDS logging-compliant dictionary from a given logging.LogRecord

pcdsutils.log.get_file_and_line_from_traceback(tb, *)

Get the last source filename and line number from the traceback.

pcdsutils.log.get_handler()

Return the handler configured by the most recent call to configure_pcds_logging().

pcdsutils.log.install_log_warning_handler([...])

Replaces warnings.showwarning with the log_warning_handler above.

pcdsutils.log.log_exception(exc_info, *[, ...])

Log an exception to the central server (i.e., logstash/grafana).

pcdsutils.log.log_warning_handler(message, ...)

Warning handler that redirects all of the warnings to a logger.

pcdsutils.log.standard_warnings_config()

Use the standard pcds warnings config.

pcdsutils.log.uninstall_log_warning_handler()

Restores the default behavior of the warnings module.

pcdsutils.log.validate_log_level(level)

Return a logging level integer for level comparison.

pcdsutils.ophyd_helpers

pcdsutils.ophyd_helpers.SubscribeCallback(...)

pcdsutils.ophyd_helpers.acquire_async(...)

Subscribe to signal, acquire data for duration seconds.

pcdsutils.ophyd_helpers.acquire_blocking(...)

Subscribe to signal, acquire data for duration seconds.

pcdsutils.ophyd_helpers.get_all_signals_from_device(device)

Get all signals in a given device.

pcdsutils.ophyd_helpers.no_device_lazy_load()

Context manager which disables the ophyd.device.Device lazy_wait_for_connection behavior and later restore its value.

pcdsutils.ophyd_helpers.subscription_context(...)

[Context manager] Subscribe to a specific event from all objects

pcdsutils.ophyd_helpers.subscription_context_device(...)

[Context manager] Subscribe to event_type from signals in device.

pcdsutils.profile

pcdsutils.profile.get_native_functions(module)

Returns a set of all functions and methods defined in module.

pcdsutils.profile.get_native_methods(...[, ...])

Recursive step of get_native_functions.

pcdsutils.profile.get_preamble(timings_dict, ...)

Returns the text that goes before the line profile chunks in the output.

pcdsutils.profile.get_profiler()

Returns the global profiler instance, creating it if necessary.

pcdsutils.profile.get_submodule_names(...)

Returns a list of the module name plus all importable submodule names.

pcdsutils.profile.get_submodules(module_name)

Returns a list of the imported module plus all submodules.

pcdsutils.profile.import_modules(module_names)

Utility function to import an iterator of module names as a list.

pcdsutils.profile.is_native(obj, module)

Determines if obj was defined in module.

pcdsutils.profile.print_results([prof, ...])

Prints the formatted results directly to terminal.

pcdsutils.profile.profiler_context(module_names)

Context manager for profiling a fixed span of an application.

pcdsutils.profile.reset_profiler()

Clears the old global profiler by replacing it with a new one.

pcdsutils.profile.save_results(filename[, ...])

Saves the formatted profiling results.

pcdsutils.profile.setup_profiler(module_names)

Sets up a profiler.

pcdsutils.profile.sort_timings([prof, ...])

Sort a profiler's stats in order of decreasing total time.

pcdsutils.profile.toggle_profiler(turn_on)

Turns the global profiler off or on.

pcdsutils.qt.callbacks

pcdsutils.qt.callbacks.WeakPartialMethodSlot(...)

A PyQt-compatible slot for a partial method.

pcdsutils.qt.designer_display

pcdsutils.qt.designer_display.DesignerDisplay(...)

Helper class for loading designer .ui files and adding logic.

pcdsutils.qt.designer_display._UiForm(*args, ...)

pcdsutils.qt.lazy

pcdsutils.qt.lazy.LazyWidget(widget_cls)

A lazy widget which only is created when first shown.

pcdsutils.qt.popbar

pcdsutils.qt.popbar.QPopBar([parent, title, ...])

A popup toolbar that shows/hide on hover a certain widget

pcdsutils.qt.popbar.QPopBarOverlay(parent, ...)

pcdsutils.qt.popbar.QVerticalLabel(*args, ...)

A vertically aligned QLabel

pcdsutils.release_notes

pcdsutils.release_notes.create_arg_parser()

pcdsutils.release_notes.generate_releases(...)

Generate the release notes.

pcdsutils.release_notes.get_releases(...)

Generate the release notes.

pcdsutils.release_notes.main()

pcdsutils.requirements

pcdsutils.requirements.compare_requirements(...)

Compare two lists of dependencies

pcdsutils.requirements.find_conda_deps(repo_root)

Get conda-recipe meta.yaml requirements as a dictionary from a repo

pcdsutils.requirements.find_meta_yaml(repo_root)

Find conda meta.yaml in a repository

pcdsutils.requirements.get_dependency_name(...)

Dependency line to dependency name

pcdsutils.requirements.get_pip_requirements(...)

Get pip requirements from a repo

pcdsutils.requirements.requirements_from_conda(...)

Build pip-style requirements from conda-recipe meta.yaml

pcdsutils.requirements.write_requirements(...)

Write pip requirements to the repository root from conda requirements

pcdsutils.utils

pcdsutils.utils.get_fully_qualified_domain_name()

Get the fully qualified domain name of this host.

pcdsutils.utils.get_instance_by_name(klass, ...)

Instantiate a class with args and kwargs.

pcdsutils.utils.import_helper(klass)

Extract the class object from a full qualified class name.

pcdsutils.version

pcdsutils.version.VersionProxy()

Version handling helper that pairs with setuptools-scm.