def _create_hidra_info( source: str, node_pool_size: int, monitor_params: parameters.MonitorParams) -> Dict[str, Any]: # Creates the HidraInfo object needed to initialize the HiDRA event source. # Reads the requested transfer type from the configuration file. If it is not # specified there, imports the suggested transfer type from the data extraction # layer and use that. query_text: str = "QUERY_NEXT" data_base_path: str = "" base_port: int = monitor_params.get_param( group="data_retrieval_layer", parameter="hidra_base_port", parameter_type=int, required=True, ) # Search the configuration file for a HiDRA selection string. If the selection # string is not found, use the file extensions from the detector layer as # selection string. hidra_selection_string: str = monitor_params.get_param( group="data_retrieval_layer", parameter="hidra_selection_string", parameter_type=str, ) if hidra_selection_string is None: hidra_selection_string = functions_pilatus.get_file_extensions() # Add an empty target at the beginning to cover the collecting node. In this way, # the index of a node in the target list will match its OM rank. targets: List[List[str]] = [["", "", str(1), ""]] # Create the HiDRA query object, as requested by the HiDRA API. rank: int for rank in range(1, node_pool_size): target_entry: List[str] = [ socket.gethostname(), str(base_port + rank), str(1), hidra_selection_string, ] targets.append(target_entry) query = Transfer(connection_type=query_text, signal_host=source, use_log=False) return { "query": query, "targets": targets, "data_base_path": data_base_path, }
def detector_distance_init( monitor_parameters: parameters.MonitorParams) -> Any: """ Initializes the psana Detector interface for detector distance data at LCLS. At LCLS, detector distance information is recovered from an Epics variable which reports the position of a stage. This function initializes the relevant Detector interface using the Epics variable identified by the 'psana_detector_distance_epics_name' entry in the 'data_retrieval_layer' parameter group of the configuration file. Arguments: monitor_parameters: A [MonitorParams] [om.utils.parameters.MonitorParams] object storing the OM monitor parameters from the configuration file. Returns: A psana object that can be used later to retrieve the data. """ return psana.Detector( monitor_parameters.get_param( group="data_retrieval_layer", parameter="psana_detector_distance_epics_name", parameter_type=str, required=True, ))
def detector_data_init(monitor_parameters: parameters.MonitorParams) -> Any: """ Initializes the psana Detector interface for x-ray detector data at LCLS. This function initializes the Detector interface for the detector identified by the 'psana_detector_name' entry in the 'data_retrieval_layer' parameter group of the configuration file. Arguments: monitor_parameters: A [MonitorParams] [om.utils.parameters.MonitorParams] object storing the OM monitor parameters from the configuration file. Returns: A psana object that can be used later to retrieve the data. """ return psana.Detector( monitor_parameters.get_param( group="data_retrieval_layer", parameter="psana_detector_name", parameter_type=str, required=True, ))
def xrays_active_init(monitor_parameters: parameters.MonitorParams) -> Any: """ Initializes the psana Detector interface for the x-ray beam status at LCLS. At LCLS, the status of the x-ray beam is determined by monitoring an EVR event source. This function initializes the Detector interface for the EVR event source identified by the 'psana_evr_source_name' entry in the 'data_retrieval_layer' parameter group of the configuration file. Arguments: monitor_parameters: A [MonitorParams] [om.utils.parameters.MonitorParams] object storing the OM monitor parameters from the configuration file. Returns: A psana object that can be used later to retrieve the data. """ evr_source_name = monitor_parameters.get_param( group="data_retrieval_layer", parameter="psana_evr_source_name", parameter_type=str, required=True, ) return psana.Detector(evr_source_name)