Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepython
# these first two lines for example purposes only, to allow user to write
# calibration information to local directory called "calib"
# should be deleted for real analysis.
import psana
psana.setOption('psana.calib-dir','calib')
from xtcav.DarkBackgroundDarkBackgroundReference import *

DarkBackgroundDarkBackgroundReference(experiment='xpptut15', 
	run_number='300',   # run number within experiment
	max_shots=1000,		# maximum number of shots to process
	validity_range=(300,302))  # range of runs for which this dark run should be used

...

-num_groups: The number of groups into which lasing off profiles are clustered. Setting this number to 1 would average all of the lasing off profiles in the run together while setting this number to 'maxshots' would not average your profiles at all. Averaging profiles helps to remove some of the noise you might find in an individual profile but may also make comparisons less accurate. Our experiments have found that setting this parameter to maxshots/3 (which should theoretically lead to groups of ~3) works best.

-dark_reference_path/lasingoff_reference_path: File paths for the generated dark and lasing off references you want to use. If none given, the most recent generated reference file (with the run being processed included in the 'validity_range') will be chosen. You can set the `dark_reference_path` when initializing both the LasingOnCharacterization and the LasingOffReference. You can set the `lasingoff_reference_path` when initializing the LasingOnCharacterization.

-roi_expand (default 1): Ratio by which to expand the image from the max and min of the region of interest. This should not affect any analysis but will affect the returned image. Do not set to <1! Call the method 'processedXTCAVImage'. If the image does not look clipped, the parameters are fine.

-snr_filter (default 10): Number of sigmas for the noise threshold. This is an important parameter. If you find that all of your images are registering as 'empty', try decreasing this parameter. If you find that your images contain a lot of noise, try increasing this parameter. This parameter is particularly important for 2+ bunch data. Since it sets a threshold based on the noise in an image, zeroing out pixels below that threshold, it is the factor that can separate the two island in case of two bunches. For two bunch data, you may need to tweak this parameter until the two bunches are separated for most of the shots. Bottom line:

  • For single bunch: As low as possible while still removing the noise (i.e.) not getting noise current profiles.
  • For double bunch: As low as possible while separating the two bunches. Call the 'processedXTCAVImage' method again, and look at the size of axis 0: this will be the number of bunches detected. You can probably write a program to automatize the determination of this parameter, until you get lets say a 95% of two bunch detection.

-validity_range (default `(current_run_number - end)`): The range of run numbers for which the reference run you are creating is valid. Parameter can be set in initialization of both the DarkBackground and the LasingOffReference. See example above. Note: Hopefully this is obvious, but if you set the validity range to (574,578) then the reference run will not be used for run 579 unless the reference path is explicitly given.

-island_split_method: (default value: 'scipylabel') Only necessary when analyzing data with more than 1 bunch. Several image processing algorithms have been created to separate bunches that appear on the same image.  See here for some algorithm details.

...