Beamlines API
General utilities
- class nexgen.beamlines.beamline_utils.BeamlineAxes(gonio: list[Axis], det_axes: list[Axis], fast_axis: Point3D | tuple[float, float, float], slow_axis: Point3D | tuple[float, float, float])[source]
Beamline specific axes for goniometer, detector and detector module.
- pydantic model nexgen.beamlines.beamline_utils.GeneralParams[source]
Parameters passed as input from the beamline.
- Parameters:
exposure_time (float) – Exposure time, in s.
beam_center (Sequence[float]) – Beam center (x,y) position, in pixels.
wavelength (float, optional) – Incident beam wavelength, in A.
transmission (float, optional) – Attenuator transmission, in %.
flux (float, optional) – Total flux.
Show JSON schema
{ "title": "GeneralParams", "description": "Parameters passed as input from the beamline.\n\nArgs:\n exposure_time (float): Exposure time, in s.\n beam_center (Sequence[float]): Beam center (x,y) position, in pixels.\n wavelength (float, optional): Incident beam wavelength, in A.\n transmission (float, optional): Attenuator transmission, in %.\n flux (float, optional): Total flux.", "type": "object", "properties": { "exposure_time": { "title": "Exposure Time", "type": "number" }, "beam_center": { "items": { "type": "number" }, "title": "Beam Center", "type": "array" }, "wavelength": { "title": "Wavelength", "type": "number" }, "transmission": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Transmission" }, "flux": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Flux" } }, "required": [ "exposure_time", "beam_center", "wavelength" ] }
- Fields:
- field beam_center: Sequence[float] [Required]
- field exposure_time: float [Required]
- field flux: float | None = None
- field transmission: float | None = None
- field wavelength: float [Required]
- pydantic model nexgen.beamlines.beamline_utils.PumpProbe[source]
Define pump probe parameters for a serial experiment on I24.
- Parameters:
pump_status (bool, optional) – Pump probe on/off.
pump_exposure (float, optional) – Pump exposure time, in s.
pump_delay (float, optional) – Pump delay, in s.
pump_repeat (int, optional) – Repeat mode.
Show JSON schema
{ "title": "PumpProbe", "description": "Define pump probe parameters for a serial experiment on I24.\n\nArgs:\n pump_status (bool, optional): Pump probe on/off.\n pump_exposure (float, optional): Pump exposure time, in s.\n pump_delay (float, optional): Pump delay, in s.\n pump_repeat (int, optional): Repeat mode.", "type": "object", "properties": { "pump_status": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "title": "Pump Status" }, "pump_exposure": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Pump Exposure" }, "pump_delay": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Pump Delay" }, "pump_repeat": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": 0, "title": "Pump Repeat" } } }
- Fields:
- field pump_delay: float | None = None
- field pump_exposure: float | None = None
- field pump_repeat: int | None = 0
- field pump_status: bool | None = False
I19-2
Directly from the python intepreter/ a python script …
The functions
- nexgen.beamlines.I19_2_nxs.nexus_writer(params: dict[str, Any], master_file: Path, timestamps: tuple[datetime, datetime] = (None, None), use_meta: bool = False)[source]
Wrapper function to gather all parameters from the beamline and kick off the nexus writer for a standard experiment on I19-2.
- Parameters:
params (dict[str, Any]) – Dictionary representation of CollectionParams.
master_file (Path) – Full path to the nexus file to be written.
timestamps (tuple[str, str], optional) – Start and end collection timestamps as datetime. Defaults to (None, None).
use_meta (bool, optional) – Eiger option only, if True use metadata from meta.h5 file. Otherwise all parameters will need to be passed manually. Defaults to False.
and
- nexgen.beamlines.I19_2_nxs.serial_nexus_writer(params: dict[str, Any], master_file: Path, timestamps: tuple[datetime, datetime] = (None, None), use_meta: bool = False, vds_offset: int = 0, n_frames: int | None = None, notes: dict[str, Any] | None = None)[source]
Wrapper function to gather all parameters from the beamline and kick off the nexus writer for a serial experiment on I19-2.
- Parameters:
params (dict[str, Any]) – Dictionary representation of CollectionParams.
master_file (Path) – Full path to the nexus file to be written.
timestamps (tuple[str, str], optional) – Start and end collection timestamps as datetime. Defaults to (None, None).
use_meta (bool, optional) – Eiger option only, if True use metadata from meta.h5 file. Otherwise all parameters will need to be passed manually. Defaults to False.
vds_offset (int, optional) – Start index for the vds writer. Defaults to 0.
n_frames (int | None, optional) – Number of images for the nexus file. Only needed if different from the tot_num_images in the collection params. If passed, the VDS will only contain the number of frames specified here. Defaults to None.
notes (dict[str, Any] | None, optional) – Any additional information to be written as NXnote, passed as a dictionary of (key, value) pairs where key represents the dataset name and value its data. Defaults to None.
can be called from python and depending on the specified detector type will run:
- nexgen.beamlines.I19_2_nxs.tristan_writer(master_file: Path, TR: CollectionParams, timestamps: tuple[str, str] = (None, None), notes: dict[str, Any] | None = None)[source]
A function to call the nexus writer for Tristan 10M detector.
- Parameters:
master_file (Path) – Path to nexus file to be written.
TR (CollectionParams) – Parameters passed from the beamline.
timestamps (tuple[str, str], optional) – Collection start and end time. Defaults to (None, None).
notes (dict[str, Any], optional) – Dictionary of (key, value) pairs where key represents the dataset name and value its data. Defaults to None.
- nexgen.beamlines.I19_2_nxs.eiger_writer(master_file: Path, TR: CollectionParams, timestamps: tuple[str, str] = (None, None), use_meta: bool = False, n_frames: int | None = None, vds_offset: int = 0, notes: dict[str, Any] | None = None)[source]
A function to call the NXmx nexus file writer for Eiger 2X 4M detector. If use_meta is set to False, then the parameter fields axes_pos and det_pos become required arguments. Otherwise, axes_pos and det_pos can be None but the code requires the information contained inside the meta file be correct and readable.
- Parameters:
master_file (Path) – Path to nexus file to be written.
TR (CollectionParams) – Parameters passed from the beamline.
timestamps (tuple[str, str], optional) – Collection start and end time. Defaults to (None, None).
use_meta (bool, optional) – If True, metadata such as axes positions, wavelength etc. will be updated using the meta.h5 file. Defaults to False.
num_frames (int, optional) – Number of images for the nexus file. Not necessary the same as the tot_num_images from the CollectionParameters. If different, the VDS will only contain the number of frames specified here. Defaults to None.
vds_offset (int, optional) – Start index for the vds writer. Defaults to 0.
notes (dict[str, Any], optional) – Dictionary of (key, value) pairs where key represents the dataset name and value its data. Defaults to None.
- Raises:
ValueError – If use_meta is set to False but axes_pos and det_pos haven’t been passed.
IOError – If the axes positions can’t be read from the metafile (missing config or broken links).
Some useful type definitions to use with these methods:
- class nexgen.beamlines.I19_2_nxs.GonioAxisPosition(id: str, start: float, inc: float = 0.0, end: float | None = None)[source]
Definition of goniometer axis name, start and end position, increment.
- Fields:
id (str): Axis name. start (float): Axis start position. increment (float): Axis increment value, only needed for the scan axis. Defaults to 0.0. end (float, optional): Axis end position, should only be passed for Tristan (if not passed, stills will be assumed). Defaults to None.
- end: float | None
Alias for field number 3
- id: str
Alias for field number 0
- inc: float
Alias for field number 2
- start: float
Alias for field number 1
- class nexgen.beamlines.I19_2_nxs.DetAxisPosition(id: str, start: float = 0.0)[source]
Definition of detector axis name and position.
- Fields:
id (str): Axis name. start (float): Axis start position.
- id: str
Alias for field number 0
- start: float
Alias for field number 1
- class nexgen.beamlines.I19_2_nxs.DetectorName(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Collection parameters schema for I19-2
- pydantic model nexgen.beamlines.I19_2_nxs.CollectionParams[source]
Collection parameters for beamline I19-2.
- Parameters:
GeneralParams (Basemodel) – General collection parameters common to multiple beamlines/experiments, such as exposure time, wavelength, …
metafile (Path | str) – Path to _meta.h5 file.
detector_name (str) – Name of the detector in use for current experiment.
tot_num_images (int, optional) – Total number of frames in a collection.
scan_axis (str, optional) – Rotation scan axis. Must be passed for Tristan.
axes_pos (list[GonioAxisPosition], optional) – list of (axis_name, start, end) values for the goniometer, passed from command line. Defaults to None.
det_pos (list[DetAxisPosition], optional) – List of (axis_name, start) values for the detector, passed from command line. Defaults to None.
Show JSON schema
{ "title": "CollectionParams", "description": "Collection parameters for beamline I19-2.\n\nArgs:\n GeneralParams (Basemodel): General collection parameters common to multiple beamlines/experiments, such as exposure time, wavelength, ...\n metafile (Path | str): Path to _meta.h5 file.\n detector_name (str): Name of the detector in use for current experiment.\n tot_num_images (int, optional): Total number of frames in a collection.\n scan_axis (str, optional): Rotation scan axis. Must be passed for Tristan.\n axes_pos (list[GonioAxisPosition], optional): list of (axis_name, start, end) values for the goniometer, passed from command line. Defaults to None.\n det_pos (list[DetAxisPosition], optional): List of (axis_name, start) values for the detector, passed from command line. Defaults to None.", "type": "object", "properties": { "exposure_time": { "title": "Exposure Time", "type": "number" }, "beam_center": { "items": { "type": "number" }, "title": "Beam Center", "type": "array" }, "wavelength": { "title": "Wavelength", "type": "number" }, "transmission": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Transmission" }, "flux": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Flux" }, "metafile": { "format": "path", "title": "Metafile", "type": "string" }, "detector_name": { "$ref": "#/$defs/DetectorName" }, "tot_num_images": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Tot Num Images" }, "scan_axis": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Scan Axis" }, "axes_pos": { "anyOf": [ { "items": { "$ref": "#/$defs/GonioAxisPosition" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Axes Pos" }, "det_pos": { "anyOf": [ { "items": { "$ref": "#/$defs/DetAxisPosition" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Det Pos" } }, "$defs": { "DetAxisPosition": { "maxItems": 2, "minItems": 1, "prefixItems": [ { "title": "Id", "type": "string" }, { "default": 0.0, "title": "Start", "type": "number" } ], "type": "array" }, "DetectorName": { "enum": [ "eiger", "tristan" ], "title": "DetectorName", "type": "string" }, "GonioAxisPosition": { "maxItems": 4, "minItems": 2, "prefixItems": [ { "title": "Id", "type": "string" }, { "title": "Start", "type": "number" }, { "default": 0.0, "title": "Inc", "type": "number" }, { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "End" } ], "type": "array" } }, "required": [ "exposure_time", "beam_center", "wavelength", "metafile", "detector_name" ] }
- Fields:
- Validators:
_parse_metafile»metafile
- field axes_pos: list[GonioAxisPosition] | None = None
- field beam_center: Sequence[float] [Required]
- field det_pos: list[DetAxisPosition] | None = None
- field detector_name: DetectorName [Required]
- field exposure_time: float [Required]
- field flux: float | None = None
- field metafile: Path [Required]
- Validated by:
_parse_metafile
- field scan_axis: str | None = None
- field tot_num_images: int | None = None
- field transmission: float | None = None
- field wavelength: float [Required]
Interface with GDA …
- nexgen.beamlines.I19_2_gda_nxs.tristan_writer(master_file: Path, TR: GDACollectionParams, axes_params: BeamlineAxes, det_params: EigerDetector | TristanDetector | SinglaDetector | JungfrauDetector | CetaDetector, timestamps: tuple[str, str] = (None, None))[source]
A function to call the nexus writer for Tristan 10M detector.
- Parameters:
master_file (Path) – Path to nexus file to be written.
TR (namedtuple) – Parameters passed from the beamline.
axes_params (BeamlineAxes) – Axes for goniometer, detector and detector module.
det_params (DetectorType) – Detector definition for Tristan.
timestamps (tuple[str, str], optional) – Collection start and end time. Defaults to None.
- nexgen.beamlines.I19_2_gda_nxs.eiger_writer(master_file: ~pathlib.Path, TR: ~nexgen.beamlines.I19_2_gda_nxs.GDACollectionParams, axes_params: ~nexgen.beamlines.beamline_utils.BeamlineAxes, det_params: ~nexgen.nxs_utils.detector.EigerDetector | ~nexgen.nxs_utils.detector.TristanDetector | ~nexgen.nxs_utils.detector.SinglaDetector | ~nexgen.nxs_utils.detector.JungfrauDetector | ~nexgen.nxs_utils.detector.CetaDetector, timestamps: tuple[str, str] = (None, None), vds_dtype: ~numpy.dtype[~typing.Any] | None | type[~typing.Any] | ~numpy._typing._dtype_like._SupportsDType[~numpy.dtype[~typing.Any]] | str | tuple[~typing.Any, int] | tuple[~typing.Any, ~typing.SupportsIndex | ~collections.abc.Sequence[~typing.SupportsIndex]] | list[~typing.Any] | ~numpy._typing._dtype_like._DTypeDict | tuple[~typing.Any, ~typing.Any] = <class 'numpy.uint16'>)[source]
A function to call the nexus writer for Eiger 2X 4M detector.
- Parameters:
master_file (Path) – Path to nexus file to be written.
TR (namedtuple) – Parameters passed from the beamline.
axes_params (BeamlineAxes) – Axes for goniometer, detector and detector module.
det_params (DetectorType) – Detector definition for Eiger.
timestamps (tuple[str, str], optional) – Collection start and end time. Defaults to (None, None).
vds_dtype (DtypeLike) – Data type for vds as np.uint##.
Collection parameters schema for I19-2 from GDA
- pydantic model nexgen.beamlines.I19_2_gda_nxs.GDACollectionParams[source]
Collection parameters for I19-2 with information extracted from GDA.
- Parameters:
GeneralParams (Basemodel) – General collection parameters common to multiple beamlines/experiments, such as exposure time, wavelength, …
meta_file (Path | str) – Path to _meta.h5 file.
xml_file (Path | str)
detector_name (str) – Name of the detector in use for current experiment.
geometry_json (Path | str, optional) – Path to GDA config JSON file describing the beamline geometry.
detector_json (Path | str, optional) – Path to GDA config JSON file describing the detector.
Show JSON schema
{ "title": "GDACollectionParams", "description": "Collection parameters for I19-2 with information extracted from GDA.\n\nArgs:\n GeneralParams (Basemodel): General collection parameters common to multiple beamlines/experiments, such as exposure time, wavelength, ...\n meta_file (Path | str): Path to _meta.h5 file.\n xml_file (Path | str):\n detector_name (str): Name of the detector in use for current experiment.\n geometry_json (Path | str, optional): Path to GDA config JSON file describing the beamline geometry.\n detector_json (Path | str, optional): Path to GDA config JSON file describing the detector.", "type": "object", "properties": { "exposure_time": { "title": "Exposure Time", "type": "number" }, "beam_center": { "items": { "type": "number" }, "title": "Beam Center", "type": "array" }, "wavelength": { "title": "Wavelength", "type": "number" }, "transmission": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Transmission" }, "flux": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Flux" }, "meta_file": { "anyOf": [ { "format": "path", "type": "string" }, { "type": "string" } ], "title": "Meta File" }, "xml_file": { "anyOf": [ { "format": "path", "type": "string" }, { "type": "string" } ], "title": "Xml File" }, "detector_name": { "title": "Detector Name", "type": "string" }, "geometry_json": { "anyOf": [ { "format": "path", "type": "string" }, { "type": "string" }, { "type": "null" } ], "title": "Geometry Json" }, "detector_json": { "anyOf": [ { "format": "path", "type": "string" }, { "type": "string" }, { "type": "null" } ], "title": "Detector Json" } }, "required": [ "exposure_time", "beam_center", "wavelength", "meta_file", "xml_file", "detector_name", "geometry_json", "detector_json" ] }
- Fields:
- field beam_center: Sequence[float] [Required]
- field detector_json: Path | str | None [Required]
- field detector_name: str [Required]
- field exposure_time: float [Required]
- field flux: float | None = None
- field geometry_json: Path | str | None [Required]
- field meta_file: Path | str [Required]
- field transmission: float | None = None
- field wavelength: float [Required]
- field xml_file: Path | str [Required]
Serial crystallography with Eiger on I24
- nexgen.beamlines.SSX_Eiger_nxs.ssx_eiger_writer(visitpath: Path | str, filename: str, beamline: Literal['i24', 'i19-2'], num_imgs: int, expt_type: Literal['extruder', 'fixed-target'] = 'fixed-target', pump_status: bool = False, **ssx_params)[source]
Gather all collection parameters and write the NeXus file for SSX using Eiger detector.
- Parameters:
visitpath (Path | str) – Collection directory.
filename (str) – Filename root.
beamline (str) – Beamline on which the experiment is being run. Allowed values: i24, i19-2.
num_imgs (int) – Total number of images collected.
expt_type (str, optional) – Experiment type, accepted values: extruder, fixed-target, (coming soon: 3Dgridscan). Defaults to “fixed-target”.
pump_status (bool, optional) – True for pump-probe experiment. Defaults to False.
- Keyword Arguments:
bit_depth (int) – bit_depth_image value, from which the vds_dtype is determined. Will default to 32 if not passed.
exp_time (float) – Exposure time, in s.
det_dist (float) – Distance between sample and detector, in mm.
beam_center (List[float, float]) – Beam center position, in pixels.
transmission (float) – Attenuator transmission, in %.
wavelength (float) – Wavelength of incident beam, in A.
flux (float) – Total flux.
start_time (datetime) – Experiment start time.
stop_time (datetime) – Experiment end time.
chip_info (Dict) – For a grid scan, dictionary containing basic chip information. At least it should contain: x/y_start, x/y number of blocks and block size, x/y number of steps and number of exposures.
chipmap (list[int]) – List of scanned blocks for the current collection. If not passed or None for a fixed target experiment, it indicates that the fullchip is being scanned.
pump_exp (float) – Pump exposure time, in s.
pump_delay (float) – Pump delay time, in s.
osc_axis (str) – Oscillation axis. Always omega on I24. If not passed it will default to phi for I19-2.
outdir (str) – Directory where to save the file. Only specify if different from meta_file directory.
- Raises:
InvalidBeamlineError – If an invalid beamline name is passed.
UnknownExperimentTypeError – If an invalid experiment type is passed.
Collection parameters schema for SSX
- pydantic model nexgen.beamlines.SSX_Eiger_nxs.SerialParams[source]
Collection parameters for a serial crystallography experiment.
- Parameters:
GeneralParams (Basemodel) – General collection parameters common to multiple beamlines/experiments, such as exposure time, wavelength, …
num_imgs (int) – Total number of frames in a collection.
detector_distance (float) – Distance between sample and deterctor, in mm.
experiment_type (str) – Type of collection.
Show JSON schema
{ "title": "SerialParams", "description": "Collection parameters for a serial crystallography experiment.\n\nArgs:\n GeneralParams (Basemodel): General collection parameters common to multiple beamlines/experiments, such as exposure time, wavelength, ...\n num_imgs (int): Total number of frames in a collection.\n detector_distance (float): Distance between sample and deterctor, in mm.\n experiment_type (str): Type of collection.", "type": "object", "properties": { "exposure_time": { "title": "Exposure Time", "type": "number" }, "beam_center": { "items": { "type": "number" }, "title": "Beam Center", "type": "array" }, "wavelength": { "title": "Wavelength", "type": "number" }, "transmission": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Transmission" }, "flux": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Flux" }, "num_imgs": { "title": "Num Imgs", "type": "integer" }, "detector_distance": { "title": "Detector Distance", "type": "number" }, "experiment_type": { "title": "Experiment Type", "type": "string" } }, "required": [ "exposure_time", "beam_center", "wavelength", "num_imgs", "detector_distance", "experiment_type" ] }
- Fields:
- field beam_center: Sequence[float] [Required]
- field detector_distance: float [Required]
- field experiment_type: str [Required]
- field exposure_time: float [Required]
- field flux: float | None = None
- field num_imgs: int [Required]
- field transmission: float | None = None
- field wavelength: float [Required]
Serial crystallography: chip tools
Tools to read a chip and compute the coordinates of a Serial Crystallography collection.
- class nexgen.beamlines.SSX_chip.Chip(name: str, num_steps: tuple[int, int], step_size: tuple[float, float], num_blocks: tuple[int, int], block_size: tuple[float, float], start_pos: tuple[float, float, float] = (0.0, 0.0, 0.0))[source]
Define a fixed target chip.
- Parameters:
name (str) – Description of the chip.
num_steps (tuple[int]) – Number of windows in each block.
step_size (tuple[float]) – Size of each window (distance between the centers in x and y direction).
num_blocks (tuple[int]) – Total number of blocks in the chip.
block_size (tuple[int]) – Size of each block.
start_pos (tuple[float]) – Start coordinates (x,y,z)
- nexgen.beamlines.SSX_chip.compute_goniometer(chip: Chip, blocks: dict | None = None, full: bool = False, ax1: str = 'sam_y', ax2: str = 'sam_x') dict[dict[str | tuple, float | int]][source]
Compute the start coordinates of each block in a chip scan.
The function returns a dictionary associating a list of axes start values and a scan direction to each scanned block. If full is True, the blocks argument will be overridden and coordinates will be calculated for every block in the chip.
- Parameters:
chip (Chip) – General description of the chip schematics: number and size of blocks, size and step of each window, start positions.
blocks (dict | None, optional) – Scanned blocks. Defaults to None.
full (bool, optional) – True if all blocks have been scanned. Defaults to False.
ax1 (str, optional) – Axis name corrsponding to slow varying axis. Defaults to “sam_y”.
ax2 (str, optional) – Axis name corrsponding to fast varying axis. Defaults to “sam_x”.
- Returns:
- Axes start coordinates and scan direction of each block.
- eg.
- {
- ‘01’/(0,0): {
‘ax1’: 0.0, ‘ax2’: 0.0, ‘direction’: 1,
}
}
- Return type:
dict[dict[str | tuple, float | int]]
- nexgen.beamlines.SSX_chip.fullchip_conversion_table(chip: Chip) dict[source]
Associate block coordinates to block number for a full chip.
- Parameters:
chip (Chip) – General description of the chip.
- Returns:
Conversion table, keys are block numbers, values are coordinates.
- Return type:
Dict
- nexgen.beamlines.SSX_chip.read_chip_map(chipmap: list[int] | None, x_blocks: int, y_blocks: int) dict[source]
Read the .map file for the current collection on a chip.
- Parameters:
chipmap (List[int] | None) – List of scanned blocks. If None, assumes fullchip.
x_blocks (int) – Total number of blocks in x direction in the chip.
y_blocks (int) – Total number of blocks in y direction in the chip.
- Returns:
A dictionary whose values indicate either the coordinates on the chip of the scanned blocks, or a string indicating that the whole chip is being scanned.
- Return type:
Dict
Serial crystallography: experiment types
- nexgen.beamlines.SSX_expt.run_extruder(goniometer_axes: list[Axis], num_imgs: int, pump_probe: PumpProbe, osc_axis: str = 'omega') tuple[list, dict, dict][source]
Run the goniometer computations for an extruder experiment.
- Parameters:
- Returns:
goniometer_axes: updated goniometer_axes list with actual values from the scan. SCAN: dictionary with oscillation scan axis values. pump_info: updated pump probe information.
- Return type:
tuple[list, dict, dict]
- nexgen.beamlines.SSX_expt.run_fixed_target(goniometer_axes: list[Axis], chip_info: dict[str, list], pump_probe: PumpProbe, chipmap: list[int] | None = None, scan_axes: list[str, str] = ['sam_y', 'sam_x']) tuple[dict, dict][source]
Run the goniometer computations for a fixed-target experiment.
- Parameters:
goniometer_axes (list[Axis]) – List of goniometer axes for current beamline.
chip_info (dict[str, list]) – General information about the chip: number and size of blocks, size and step of each window, start positions, number of exposures.
pump_probe (PumpProbe) – Pump probe parameters.
chipmap (list[int], optional) – List of blocks scanned. If None is passed, assumes a fullchip.
scan_axes (list[str, str], optional) – List of scan axes, in order slow,fast. Defaults to [“sam_y”, “sam_x”].
- Raises:
ValueError – If one or both of the axes names passed as input are not part of the goniometer axes.
ValueError – if chip_info hasn’t been passed or is an empty dictionary.
- Returns:
SCAN: Dictionary with grid scan values. pump_info: Updated pump probe information.
- Return type:
tuple[dict, dict]
Electron diffraction: Singla writer
- nexgen.beamlines.ED_singla_nxs.singla_nexus_writer(master_file: ~pathlib.Path | str, det_distance: float, exp_time: float, ED_cs: ~typing.Dict = {'convention': 'ED', 'origin': (0, 0, 0), 'x': Axis(name='x', depends='.', transformation_type=<TransformationType.TRANSLATION: 'translation'>, vector=(0.0, 1.0, 0.0), start_pos=0.0, increment=0.0, num_steps=0, offset=(0.0, 0.0, 0.0)), 'y': Axis(name='y', depends='x', transformation_type=<TransformationType.TRANSLATION: 'translation'>, vector=(-1.0, 0.0, 0.0), start_pos=0.0, increment=0.0, num_steps=0, offset=(0.0, 0.0, 0.0)), 'z': Axis(name='z', depends='y', transformation_type=<TransformationType.TRANSLATION: 'translation'>, vector=(0.0, 0.0, 1.0), start_pos=0.0, increment=0.0, num_steps=0, offset=(0.0, 0.0, 0.0))}, datafiles: ~typing.List[~pathlib.Path | str] = None, convert2mcstas: bool = False, **params)[source]
Gather all collection parameters and write the NeXus file for an electron diffraction collectio using SINGLA detector.
- Parameters:
master_file (Path | str) – Singla master file.
det_distance (float) – Sample-detector distance, in mm.
exp_time (float) – Exposure time, in s.
ED_cs (Dict, optional) – Definition of the ED coordinate system in use. Defaults to {“convention”: “ED”, “origin”: (0, 0, 0), “x”: Axis(“x”, “.”, “translation”, [0, 1, 0]), “y”: Axis(“y”, “x”, “translation”, [-1, 0, 0]), “z”: Axis(“z”, “y”, “translation”, [0, 0, 1]),}
datafiles (List[Path | str], optional) – List of data files. Defaults to None.
convert2mcstas (bool, optional) – Convert vectors to mcstas if required. Defaults to False.
- Keyword Arguments:
n_imgs (int) – Total number of images in collection.
scan_axis (List[str, float, float]) – Rotation axis name, start and increment.
outdir (Path | str) – Directory where to save the file. Only specify if different from meta_file directory.
beam_center (List[float, float]) – Beam center position, in pixels.
wavelength (float) – Wavelength of incident beam, in A.
start_time (datetime) – Experiment start time.
new_source_info (Dict) – Information about Source that might differ from the default. eg. {“facility_id”: “MICROSCOPE”, “name”: “Not Diamond”}
vds_writer (str) – Write dataset or external file.
GDA integration tools
Read geometry and detector parameters from GDA-generated JSON files
Tools to extract goniometer and detector parameters from GDA JSON files.
- class nexgen.beamlines.GDAtools.GDAjson2params.JSONParamsIO(json_file: Path | str)[source]
Read JSON file and exctract parameters.
- get_detector_axes_from_file() list[Axis][source]
Read the detector axes information from the GDA-supplied json file.
- get_detector_params_from_file() EigerDetector | TristanDetector | SinglaDetector | JungfrauDetector | CetaDetector[source]
Read the detector parameters from the GDA-supplied json file.
Gather beamline and collection information from GDA-generated xml file
IO tool to gather beamline and collection information from xml file.
- class nexgen.beamlines.GDAtools.ExtendedRequest.ExtendedRequestIO(xmlfile: Path | str)[source]
Define an ExtendedRequest object which in GDA gathers all the information regarding beamline and collection into an xml file.
- nexgen.beamlines.GDAtools.ExtendedRequest.read_det_position_from_xml(ecr: ExtendedRequestIO, det_description: str) list[float][source]
Extract the detector position contained in the xml file.
- Parameters:
ecr (ExtendedRequestIO) – XML tree parser.
det_description (str) – Detector description
- Returns:
Detector axes positions in the order [2theta, det_z]
- Return type:
list[float]
- nexgen.beamlines.GDAtools.ExtendedRequest.read_scan_from_xml(ecr: ExtendedRequestIO)[source]
Extract information about the scan contained in the xml file.
- Parameters:
ecr (ExtendedRequestIO) – XML tree parser.
xmlfile (Path | str) – Path to xml file.
- Returns:
Name of the rotation scan axis pos (dict): Dictionary containing the (start,end,increment) values for each goniometer axis. num (int): Number of images written.
- Return type:
scan_axis (str)