AFL.automation.instrument.SINQSANS_NICOS#
Classes
|
|
|
A client for interacting with a NICOS server from python scripts or the command line. |
|
|
|
- class AFL.automation.instrument.SINQSANS_NICOS.SINQSANS_NICOS(overrides=None)[source]#
- defaults = {'absolute_calibration_factor': 1, 'beamstop_in': -70, 'beamstop_out': -200, 'data_path': '', 'detector': 'sansdet', 'detector_index': 0, 'empty transmission': 1, 'exposure': 1.0, 'nicos_host': 'sans.psi.ch', 'nicos_password': '', 'nicos_port': 1301, 'nicos_user': 'user', 'normalization_monitor': 'monitor1', 'normalization_monitor_index': 0, 'num_pixel1': 128, 'num_pixel2': 128, 'pixel1': 0.075, 'pixel2': 0.075, 'reduced_data_dir': '', 'transmission strategy': 'sum', 'transmission_box_radius_x': 20, 'transmission_box_radius_y': 20}#
- connect_to_nicos()[source]#
Connect to the NICOS server using the configuration parameters.
This method establishes a connection to the NICOS server using the host, port, user, and password specified in the configuration.
Notes
The connection parameters are retrieved from the config attribute of the instance. If the connection fails, an exception will be raised.
- measureTransmission(exposure=100000.0, exposure_type='detector', set_empty_transmission=False, return_full=False)[source]#
Measure the transmission of the sample.
This method measures the transmission of the sample by performing a series of commands to move the beamstop, open the shutter, and expose the sample. The transmission is calculated based on the counts from the detector and the normalization monitor.
- Parameters:
exposure (float, optional) – The exposure time or counts (default is 1e5).
exposure_type (str, optional) – The type of exposure, must be one of ‘time’, ‘detector’, or ‘monitor’ (default is ‘detector’).
set_empty_transmission (bool, optional) – If True, set the measured transmission as the empty transmission (default is False).
return_full (bool, optional) – If True, return the full transmission data including raw counts and empty transmission (default is False).
- Returns:
The measured transmission. If return_full is True, returns a tuple containing the scaled transmission, monitor counts, sample counts, and empty transmission.
- Return type:
Notes
This method performs the following steps: 1. Close the shutter and move the beamstop out. 2. Open the shutter and expose the sample. 3. Close the shutter and move the beamstop back in. 4. Calculate the transmission based on the counts from the detector and the normalization monitor. 5. Optionally set the measured transmission as the empty transmission. 6. Return the measured transmission or the full transmission data.
- expose(name=None, exposure=None, exposure_transmission=None, block=True, reduce_data=True, measure_transmission=True, save_nexus=True, exposure_type='detector')[source]#
Perform an exposure with the specified parameters.
This method performs an exposure of the sample, optionally measuring the transmission, reducing the data, and saving it in Nexus format.
- Parameters:
name (str, optional) – The name of the sample (default is None).
exposure (float, optional) – The exposure time or counts (default is None).
exposure_transmission (float, optional) – The exposure time or counts for transmission measurement (default is None).
block (bool, optional) – If True, block until the exposure is complete (default is True).
reduce_data (bool, optional) – If True, reduce the data after exposure (default is True).
measure_transmission (bool, optional) – If True, measure the transmission before exposure (default is True).
save_nexus (bool, optional) – If True, save the data in Nexus format (default is True).
exposure_type (str, optional) – The type of exposure, must be one of ‘time’, ‘detector’, or ‘monitor’ (default is ‘detector’).
- Raises:
ValueError – If the exposure type is not one of ‘time’, ‘detector’, or ‘monitor’.
FileNotFoundError – If the data file cannot be located after multiple attempts.