You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Run dependent parameters: 

First up are functions that will return e.g. the region-of-interest boundaries for each run. During the experiment, this should be kept up-to-date so if the setup changes, the littleData file will get an entry with new boundaries for a just finished range of runs. This way, the littleDataRun script will always use the correct region of interest for each run.

UserData: Roi definition

 

def getROIs(run, expname):
    if run<=314:
        sigROI = [[1,2], [85,120], [0,388]]
        sigROI2 = [[1,2], [0,184], [30,315]]
    else:
        sigROI = [[1,2], [83,112], [0,388]]
        sigROI2 = [[1,2], [0,184], [30,315]]
    return sigROI, sigROI2

 

ROI: 

Below is an entry that show how to add a ROI on a cs140k detector to the littleData. the integral of the ROI and the center-of-mass values for the ROI will always be stored. WriteArea=True will cause the full ROI be written to the event.

User Data: small subarea

 

have_cs140_0 = checkDet(env, 'cs140_0')
if have_cs140_0:
    cs140_0 = DetObject('cs140_0' ,env, int(run), name='vonHamos')
	for iROI, ROI in enumerate(ROIs):    
		cs140_0.addROI('ROI%d'%iROI,ROI, rms=cs140_0.rms)                                                 
    dets.append(cs140_0)

 
 

ROI: projection

 
For a second cs140 detector, we chose a larger ROI, but only save the projections in "x" and "y". Here the projection is done without any further treatment (first lines) and with a threshold of 25 ADU. A threshold using the noise of the pixel as determined in the pedestal run is also possible (use cutRMS = xx where xx is the number of noise RMS a pixel needs to be higher as)

UserData: projections of ROI

 

have_cs140_1 = checkDet(env, 'cs140_1')
if have_cs140_1:
    cs140_1 = DetObject('cs140_1' ,env, int(run), name='Rowland')
	for iROI, ROI in enumerate(ROIs):    
		cs140_1.addROI('ROI%d'%iROI,ROI, rms=cs140_1.rms)
    	cs140_1.ROI0.addProj('_x', axis=0)
    	cs140_1.ROI0.addProj('_y', axis=1)
    	cs140_1.ROI0.addProj('_ythres', axis=1, singlePhoton=False, cutADU=25.)
    	cs140_1.ROI0.addProj('_xthres', axis=0, singlePhoton=False, cutADU=25.)
    dets.append(cs140_1)
 

Use of SmallDataAna_psana

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.

Creating an average image

 

In order to decide on the proper ROI, fit a team center or make a mask, the first step is always to create an image that you would like to use as base. This is achieved using the following function

 
SDAna In: anaps.AvImage()
 
This will by default create an average image of 100 events of an area detector. 
 
The full command with all its options and a examples is here:
 

AvImage

 

LDana In [1]: anaps.AvImage?
Type:        instancemethod
String form: <bound method LittleDataAna_psana.AvImage of <LittleDataAna_psana.LittleDataAna_psana object at 0x7fd37fe03590>>
File:        /reg/d/psdm/xpp/xpptut15/res/littleData/xppmodules/scripts/LittleDataAna_psana.py
Definition:  anaps.AvImage(self, detname='None', numEvts=100, thresADU=0.0, thresRms=0.0,useLdat=False, nSkip=0, minIpm=-1.0, common_mode=True)
Docstring:   <no docstring>

LDana In [2]: anaps.AvImage()
detectors in event: 
cs140_rob
opal_1
Select detector to select ROI of?:
cs140_rob
try get detector info to make average image for:  cs140_rob
try to make psana Detector with:  cs140_rob
requested  100  used  100

LDana In [3]: anaps.plotAvImage()
plot AvImg_cs140_rob using the 5/99.5 percentiles as plot min/max: (1603.9, 1950.21)

 

If you would like to take a quick look at your average image before proceeding, use as seen above:
 
 
SDAna In: anaps.plotAvImage()
 

which will result in a figure like this popping up:

Extracting information from the average image

The following functions will all ask question on the ipython command line (mainly to check if you are happy with your selections and/or if you are done).
These functions require interaction with the plots and currently do not work with the notebooks. There is a  automatic version of the center finding that would work in a notebook, but is still under testing.

ROI

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 LittleDataProducer_userData.py file. Below both what the terminal session looks like (here with an optionla 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 LittleDataProducer file. Figure 3 shows 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.

Select ROI

 

LDana 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]]
  • No labels