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 smallData file will get an entry with new boundaries for a just finished range of runs. This way, the smallDataRun script will always use the correct region of interest for each run.

Azimuthal Integration

Another option is to reduce the data by azimuthally averaging the signal. Here, we need to know the center for the integration as well as the detector distance and beam energy. The latter two are mostly important for the q-values of the bins that will also be stored in the littleData. As conditions will change during an experiment, it is convenient to have a function that return the correct integration setup for each (range of) run(s).

run dependent integration parameters

def getAzIntParams(run):
    ret_dict = {'eBeam': 8.015}
    ret_dict['cspad_center'] = [87697.946016760892, 94865.383526655729]
    ret_dict['cspad_dis_to_sam'] = 110.
    return ret_dict

 

UserData: azimuthal integration

haveCspad = checkDet(ds.env(), 'cspad')
if haveCspad:
    cspad = DetObject('cspad' ,ds.env(), int(run), name='cspad')
    for iROI,ROI in enumerate(ROIs):
        cspad.addROI('ROI_%d'%iROI, ROI)
 
    cspad.azav_eBeam=azIntParams['eBeam']
    if azIntParams.has_key('cspad_center'):
        cspad.azav_center=azIntParams['cspad_center']
        cspad.azav_dis_to_sam=azIntParams['cspad_dis_to_sam']
        try:
            cspad.addAzAv(phiBins=7)
        except:
            pass
    dets.append(cspad)

 

Use of SmallDataAna_psana and extracting information from the average image

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. This is described in the section bout Working with Images from camera/areadetectors

Beam center and radius

SDAna In: anaps.FitCircle()
This will by draw the image and let you either select points by clicking or define a threshold above which points are selected and fitted to a single circle. The azimuthal integration code needs a center point which the circle fitting will return.
Below are an example fit: first the image you created first will pop up. You can then either select points by hand or use a threshold (highest x% of pixels). The chosen pixel location will be shown and you are adjust your threshold until you are satisfied. In the last step, the fit is performed and overlaid on the image. The beam center and radius of the circle are printed. You will have to know about your sample to use the radius to extract the detector - sample distance. The latter will not affect she shape of the azimuthally integrated data (a wrong center will!), but the q-bin values will be wrong.
FitCircle has an optional argument (useMask=False/True) that defaults to False. If set to True, the mask stored in the calib directory will be applied.

 

SDana In [2]: anaps.FitCircle()
plot AvImg_cspad using the 5/99.5 percentiles as plot min/max: (0.199616, 263.383)
Select Circle Points by Mouse?:
n
Select Circle Points with threshold (y/n):
y
min percentile % of selected points:
99.2
thresP 248.786973755
Happy with this threshold (y/n):
y
x,y:  99652.2541599 87977.9162216  R  18603.6250138

Azimuthal integration

SDAna In: anaPS.anaps.addAzInt?
Type:        instancemethod
String form: <bound method SmallDataAna_psana.addAzInt of <SmallDataAna_psana.SmallDataAna_psana object at 0x7f7731f13f10>>
File:        /reg/data/ana13/xpp/xppo6616/results/littleData/xppmodules/scripts/SmallDataAna_psana.py
Definition:  anaps.addAzInt(self, detname=None, phiBins=1, qBin=0.01,eBeam=9.5, center=None, dis_to_sam=None)

This function will set up the azimuthal integration. It will also correct for the LCLS Xray polarization and the geometric acceptance. The center and distance to sample  are needed. Then this code can be applied to any average image by:

 

SDana In [2]: anaps.AzInt?
Type:        instancemethod
String form: <bound method SmallDataAna_psana.AzInt of <SmallDataAna_psana.SmallDataAna_psana object at 0x7f7731f13f10>>
File:        /reg/data/ana13/xpp/xppo6616/results/littleData/xppmodules/scripts/SmallDataAna_psana.py
Definition:  anaps.AzInt(self, detname=None, use_mask=False)
It returns the data arrays. The q-bins are stored as well in anaps.<detname>.azav_q

 

  • No labels