Versions Compared

Key

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

...


Code Block
languagepy
themeRDark
########################################################## 
## User Input start -->
########################################################## 
##adding raw timetool traces:
#defaultDets.append(ttRawDetector(env=ds.env()))
##adding wave8 traces:
#defaultDets.append(wave8Detector('Wave8WF'))
########################################################## 
## <-- User Input end 
########################################################## 

Time tool analysis

XTCAV values

Run-dependent variables: Area detectors analysis

In order to keep the filesizes small to avoid issue when analysis the smallData files, we try to extract the important information gleaned from areaDetectors at an event-by-event basis and only save these pieces of data. Implementation examples of each of the analysis functions that are readily available can be found in <smalldata_tools>/producers/smalldata_producer_template.py.

Please reach out to your data and controls POC to discuss analysis needs for your experiments. The POC will make sure the functions you need are prepared in the main producer file, and you should only have to change the argument's values, such as region of interest or thresholds, according the ongoing experimental conditions.

Generally speaking, the parameters for each analysis functions are set from a run-dependent logic as shown here:

Code Block
languagepy
themeRDark
titleAnalysis function parameters
linenumberstrue
def getFuncParam(run):
	"""
    """
    if isinstance(run,str):
        run=int(run)
    ret_dict = {}
    if run<21:
    	func_dict = {}
        func_dict['param1'] = <param>
        func_dict['param2'] = <param>
        func_dict['param3'] = <param>
        ret_dict['detname'] = func_dict
	else:
    	func_dict = {}
        func_dict['param1'] = <param>
        func_dict['param2'] = <param>
        func_dict['param3'] = <param>
        ret_dict['detname'] = func_dict      
	return ret_dict

Several analysis functions or detectors can be set up this way.

An example: Regions of interest (ROIs)

In the smd_producer.py, the function to define the ROIs goes as follow:

Code Block
languagepy
themeRDark
def getROIs(run):
    """ Set parameter for ROI analysis. Set writeArea to True to write the full ROI in the h5 file.
    See roi_rebin.py for more info
    """
    if isinstance(run,str):
        run=int(run)
    ret_dict = {}
    if run<21:
        roi_dict = {}
        roi_dict['ROIs'] = [ [[1,2], [127,394], [655,923]]] # can define more than one ROI
        roi_dict['writeArea'] = True
        roi_dict['thresADU'] = None
        ret_dict['jungfrau1M'] = roi_dict
    elif run>20 and run<43:
        roi_dict = {}
        roi_dict['ROIs'] = [chip22] # can define more than one ROI
        roi_dict['writeArea'] = True
        roi_dict['thresADU'] = None
        ret_dict['jungfrau1M'] = roi_dict
    elif run>42:
        roi_dict = {}
        roi_dict['ROIs'] = [chip22] # can define more than one ROI
        roi_dict['writeArea'] = True
        roi_dict['thresADU'] = None
        ret_dict['jungfrau1M'] = roi_dict
    return ret_dict

Besides, the ROI definition, the parameters are the following:

writeArea: whether to write the full ROI to file or only the statistics (intensity sum, and other statistics)

thresADU: pixel intensity threshold. Any pixel below that value are set to 0

Use of SmallDataAna_psana to select a ROI

For the use of the interactive features of SmallDataAna_psana, we recommend to start it in an ipython session as interactive grabbing of user input is currently not implemented via the notebook. The first step is to create an average image that shows the feature of interest well.
From from smalldata_tools top level directory, run the following command to launch an IPython shell with pre-loaded a data analysis class for the relevant run

Code Block
languagebash
themeRDark
./producers/runSmallDataAna -r <#> [-e <expname>]

The average image can be then made by running

SDAna In: anaps.AvImage()

This will by default create an average image of 100 events of an area detector. The method will list and prompt for a detector name if more than one was recorded.
The full command with all its options can be looked via using the "?" feature of python:

SDAna In: anaps.AvImage?

More details on the interactive IPython capabilities can be found in the section Working with Images from camera/areadetectors

A ROI selection utility can then be used:

SDAna In: anaps.SelectRegion()

This will by draw the image and let you select a rectangular area of interest with the mouse. At this point, you click on two corners of the ROI. Once you are happy with your selection, it will print the numbers you need to enter in the producer file. Below both what the terminal session looks like (here with an optional selection of different plot limits, by default 5% and 99.5% are used). Figure 2 will come up when you get asked if you are happy with the selection which appears on the right side of that figure. "n" means you can to click again until you are satisfied. "y" will print the ROI as it should be entered in the smd_producer file.

A new figure will also show the ROI again, this time obtained from the raw data rather than the image (a technical detail). The more striking different is that the scaling/limit are now taken from only the ROI rather than the whole image.

Code Block
languagepy
themeRDark
SDana In [3]: anaps.SelectRegion(limits=[5,99.8])
plot AvImg_cs140_rob using the 5/99.8 percentiles as plot min/max: (1603.9, 1994.84)
Happy with this selection:
y
ROI: [[1,2], [55,76], [308,335]]
More details on the different analysis function can be found under

See 1.2 Area Detector treatment with

DetObject

DetObject#1.2AreaDetectortreatmentwithDetObject-InteractiveSmallDataAnasession