API Reference¶
pxr_reduce
¶
Reducing pxr data from bl 11.0.1.2
This package provides a loader for PRSoXR data from beamline 11.0.1.2 taken with the area detector camera.
PrsoxrLoader(files, AI_file=None, *, auto_load=False, energy_resolution=20, **kwargs)
¶
Loader for PRSoXR data from beamline 11.0.1.2 taken with the CCD camera.
Parameters¶
files : list List of .fits to be loaded. Include full filepaths
>>> # Recommended Usage
>>> import pathlib
>>> path_s = pathlib.Path('../ALS/2020 Nov/MF114A/spol/250eV')
>>> files = list(path_s.glob('*fits')) # All .fits in path_s
The newly created 'files' is now a list of filepaths to each reflectivity point.
pathlib.Path
A filepath to a complimentary .txt file that contains updated metadata. This is only used for data collected with the 'Beamline Scan Panel' at BL11012.
bool
Should the images be loaded automatically upon creating object?
**kwargs: process_vars that want to be updated at the time of creation.
Attributes¶
exposure_offset: float [s] Offset to add to camera exposure time. Time it takes to physically open and close shutter. This should be measured in advanced and not changed often. energy_resoltion: float Energy will be normalized based on the following equation: np.round(self.data['energy']energy_resolution)/energy_resolution Enables rounding to non-integer values. Default rounds to 0.05 eV sam_th_offset: float [th] Offset added to sam_th at the time of measurement default is None sam_th_correction: Bool Default is True. It will determine the sam_th_offset based on the initial measurement positions energy_offset: float [eV] Optional offset to the energy value. Defaults at 0 det_pixel_size: float [mm/pixel] Size of detector pixel. May change as detectors change roi_height: int Size of the ROI used to integrate over beam spot. Vertical dimension roi_width: int Size of the ROI used to integrate over beam spot. Horizontal Dimension trim_x: int Number of pixels on the edge of the detector to remove fromm consideration trim_y: int Number of pixels on the edge of the detector (vertical) to remove from considerations stitch_cutoff: float ['ratio'] Used to identify positions at which a 'stitch' has occured between the data. drop_failed_stitch: bool Decision on whether to drop all datapoints that did not stitch correctly. Defaults to True, a warning will be given stitch_mark_tol: float Value used to verify whether or not a tracked motor for stitching has moved dark_pix_offset: int [pixels] Number of pixels to offset the region used for dark subtraction from the edge of the frame new_scan_marker: float [deg] How far the 'sam_th' motor needs to move in order to indicate a new 'scan' starting from 0 drift_distance: int [pixels] Distance that the beam can drift from its nominal positions mask_threshold: int [counts] Threshold used to identify where data-points are potentially located filter_size: int Filter size for the zinged image darkside: 'RHS' or 'LHS' Side of the image to collect the dark image. saturate_threshold: int [counts] A value to indicate whether an image has been saturated or not. It will check how close the maximum intensity is to 2*16.
Notes¶
Print the loader to view variables that will be used in reduction. Update them using the attributes listed in this API.
loader = PrsoxrLoader(files, name='MF114A_spol') print(loader) #Default values Sample Name - MF114A Number of scans - 402 ____ Reduction Variables ____ Shutter offset = 0.00389278 Sample Location = 0 Angle Offset = -0.0 Energy Offset = 0 SNR Cutoff = 1.01 ____ Image Processing ____ Image X axis = 200 Image Y axis = 200 Image Edge Trim = (5, 5) Dark Calc Location = LHS Dizinger Threshold = 10 Dizinger Size = 3 loader.shutter_offset = 0.004 #Update the shutter offset
np.ndarray (Boolean)
Array with dimensions equal to an image. Elements set to False will be
excluded when finding beamcenter.
Recommended usage¶
loader = loader = PrsoxrLoader(files) mask = np.full_like(loader.images[0], True, dtype=bool) mask[:50,:50] = False # block out some region loader.mask = mask
Once process attributes have been setup by the user, the function can be called to
load the data. An ROI will need
to be specified at the time of processing. Use the self.check_spot() function
to find appropriate dimensions.
refl = loader(h=40, w=30)
Data that has been loaded can be exported using the self.save_csv(path) and
self.save_hdf5(path) functions.
Source code in src/pxr_reduce/loader.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
calc_refl(drop_duplicates=True)
¶
Function that performs a data reduction of PRSOXR data.