vdmtools.io.read_one_or_many
- vdmtools.io.read_one_or_many(paths: Iterable[Path], scan_names: Iterable[str], **kwargs) List[ScanResults]
- vdmtools.io.read_one_or_many(paths: Path, scan_names: str, **kwargs) ScanResults
Read one many ScanResults from the given paths.
- Parameters:
paths (List[Path] or Path) – The paths or path to the scan results directories.
scan_names (Iterable[str] or str) – The scan names in the order they were performed. If not given, the scan names will be empty strings.
- Returns:
The single or many ScanResults. If many, they are sorted by scan start time.
- Return type:
List[ScanResults] or ScanResults
- Raises:
TypeError – If the types of paths and scan_names are not valid.
Examples
Read one ScanResults:
>>> from pathlib import Path >>> from vdmtools.io import read_one_or_many >>> path = Path("/eos/user/v/vdmdata/vdmoutput/www/analysed_data/8999_28Jun23_230143_28Jun23_232943") >>> scan_results = read_one_or_many(path) >>> scan_results ScanResults from: /eos/user/v/vdmdata/vdmoutput/www/analysed_data/8999_28Jun23_230143_28Jun23_232943 Scan name: VdM1 Scan ID: 8999_28Jun23_230143_28Jun23_232943 ScanConditions: Fill: 8999 Run: (369802, 369802) Scan names: ('X1', 'Y1') Scan types: ('NormalX', 'NormalY') Scan time windows: First Scan: 2023-06-28 22:25:04 - 2023-06-28 22:29:56 Second Scan: 2023-06-28 22:31:27 - 2023-06-28 22:36:22 Beta star: 19.2 Angle: 0.0 Offset: [0.0, 0.0] Particle type B1: proton Particle type B2: proton COM energy B1 (GeV): 6799 COM energy B2 (GeV): 6799 Results: Fits: {'SGConst', 'SG', 'DG'} Detectors: ['BCM1F', 'BCM1FUTCA', 'HFET', 'HFOC', 'PLT'] Corrections: {'Background', 'noCorr', 'BeamBeam_DynamicBeta'}
Read many ScanResults:
>>> from pathlib import Path >>> from vdmtools.io import read_one_or_many >>> paths = [ ... Path("/eos/user/v/vdmdata/vdmoutput/www/analysed_data/8999_28Jun23_230143_28Jun23_232943"), ... Path("/eos/user/v/vdmdata/vdmoutput/www/analysed_data/8999_29Jun23_004658_29Jun23_011220"), ... ] >>> names = ["VdM1", "VdM2"] >>> scan_results = read_one_or_many(paths, names) >>> scan_results[0] ScanResults from: /eos/user/v/vdmdata/vdmoutput/www/analysed_data/8999_28Jun23_230143_28Jun23_232943 Scan name: VdM1 Scan ID: 8999_28Jun23_230143_28Jun23_232943 ScanConditions: Fill: 8999 Run: (369802, 369802) Scan names: ('X1', 'Y1') Scan types: ('NormalX', 'NormalY') Scan time windows: First Scan: 2023-06-28 23:01:43 - 2023-06-28 23:17:35 Second Scan: 2023-06-28 23:29:43 - 2023-06-28 23:45:35 Beta star: 19.2 Angle: 0.0 Offset: [0.0, 0.0] Particle type B1: proton Particle type B2: proton COM energy B1 (GeV): 6799 COM energy B2 (GeV): 6799 Results: Fits: {'SG', 'SGConst', 'DG'} Detectors: ['BCM1F', 'BCM1FUTCA', 'HFET', 'HFOC', 'PLT'] Corrections: {'BeamBeam_DynamicBeta', 'noCorr', 'Background'} >>> scan_results[1] ScanResults from: /eos/user/v/vdmdata/vdmoutput/www/analysed_data/8999_29Jun23_004658_29Jun23_011220 Scan name: VdM2 Scan ID: 8999_29Jun23_004658_29Jun23_011220 ScanConditions: Fill: 8999 Run: (369802, 369802) Scan names: ('X1', 'Y1') Scan types: ('NormalX', 'NormalY') Scan time windows: First Scan: 2023-06-29 00:46:58 - 2023-06-29 01:04:49 Second Scan: 2023-06-29 01:12:20 - 2023-06-29 01:30:20 Beta star: 19.2 Angle: 0.0 Offset: [0.0, 0.0] Particle type B1: proton Particle type B2: proton COM energy B1 (GeV): 6799 COM energy B2 (GeV): 6799 Results: Fits: {'SG', 'SGConst', 'DG'} Detectors: ['BCM1F', 'BCM1FUTCA', 'HFET', 'HFOC', 'PLT'] Corrections: {'BeamBeam_DynamicBeta', 'noCorr', 'Background'}