-
Notifications
You must be signed in to change notification settings - Fork 7
Description
"ps" is used for different things in the code base.
- instance 1, related to peak center
ps = based on original peak stats ; used in collection environment. may be useful in analysis. - instance 2, related to aged g2 from two-time
ps = - instance 3a,
get_timepixel_datacomment on line 36
ps = - instance 3b,
get_pvlist_from_postinternal variable that is returned
ps = - instance 4, speckle modules with variable
ps = Poission distribution. Docstring is good. no clarification needed
Instance 1
pyCHX/pyCHX/chx_generic_functions.py
Lines 996 to 1006 in 6e991bb
| def ps( y,shift=.5, replot=True, logplot='off', x= None): | |
| ''' | |
| Dev 16, 2018 | |
| Modified ps() function in 95-utilities.py | |
| function to determine statistic on line profile (assumes either peak or erf-profile) | |
| Input: | |
| y: 1D array, the data for analysis | |
| shift: scale for peak presence (0.5 -> peak has to be taller factor 2 above background) | |
| replot: if True, will plot data (if error func) with the fit and peak/cen/com position | |
| logplot: if on, will plot in log scale | |
| x: if not None, give x-data |
There are notes in code to @mrakitin .
Is this used in analysis to not have to fit to find the center of a peak?
It seems it was associated with a Bluesky profile file. Is this new one used in bluesky?
What does "ps" mean in this context? peak stats? peak scaling?
Instance 2
show_g12q_aged_g2()
pyCHX/pyCHX/Two_Time_Correlation_Function.py
Lines 599 to 621 in 6e991bb
| ax1 = plt.subplot(gs[1]) | |
| linS1 = [ [0]*len(age_center ), np.int_(age_center - slice_width//2 ) ] | |
| linS2 = [ [0]*len(age_center ), np.int_(age_center + slice_width//2 ) ] | |
| linE1 = [ np.int_(age_center - slice_width//2 ), [0]*len(age_center) ] | |
| linE2 = [ np.int_(age_center + slice_width//2 ), [0]*len(age_center) ] | |
| linC = [ [0]*len(age_center ), np.int_(age_center ) ] | |
| for i in range( len(age_center ) ): | |
| ps = linS1[1][i] | |
| pe = linE1[0][i] | |
| if ps>=N:s0=ps - N;s1=N | |
| else:s0=0;s1=ps | |
| e0 = s1;e1=s0 | |
| #if pe>=N:e0=N;e1=pe - N | |
| #else:e0=pe;e1=0 | |
| ps = linS2[1][i] | |
| pe = linE2[0][i] | |
| if ps>=N:S0=ps - N;S1=N | |
| else:S0=0;S1=ps | |
| #if pe>=N:e0=N;E1=pe - N | |
| #else:E0=pe;E1=0 | |
| E0=S1;E1=S0 |
Instance(s) 3
in xpcs_timepixelmodule in 2 functions
Lines 25 to 36 in 6e991bb
| def get_timepixel_data( data_dir, filename, time_unit= 1 ): | |
| '''give a csv file of a timepixel data, return x,y,t | |
| x, pos_x in pixel | |
| y, pos_y in pixel | |
| t, arrival time | |
| time_unit, t*time_unit will convert to second, in reality, this value is 6.1e-12 | |
| return x,y,t (in second, starting from zero) | |
| ''' | |
| data = pds.read_csv( data_dir + filename ) | |
| #'#Col', ' #Row', ' #ToA', | |
| #return np.array( data['Col'] ), np.array(data['Row']), np.array(data['GlobalTimeFine']) #*6.1 #in ps |
"ps" is photon statitisics?
Lines 50 to 72 in 6e991bb
| def get_pvlist_from_post( p, t, binstep=100, detx=256, dety=256 ): | |
| '''YG.DEV@CHX Nov, 2017 to get a pos, val list of phonton hitting detector by giving | |
| p (photon hit pos_x * detx + y (photon hit pos_y), t (photon hit time), and the time bin | |
| The most important function for timepix | |
| Input: | |
| p: array, int64, coordinate-x * det_x + coordinate-y | |
| t: list, int64, photon hit time | |
| binstep: int, binstep (in t unit) period | |
| detx,dety: int/int, the detector size in x and y | |
| Output: | |
| positions: int array, (x*detx +y) | |
| vals: int array, counts of that positions | |
| counts: int array, counts of that positions in each binstep | |
| ''' | |
| v = ( t - t[0])//binstep | |
| L= np.max( v ) + 1 | |
| arr = np.ravel_multi_index( [ p, v ], [detx * dety,L ] ) | |
| uval, ind, count = np.unique( arr, return_counts=True, return_index=True) | |
| ind2 = np.lexsort( ( p[ind], v[ind] ) ) | |
| ps = (p[ind])[ind2] | |
| vs = count[ind2] | |
| cs = np.bincount(v[ind]) | |
| return ps,vs,cs |
"ps" is photon positions
Instance 4
in speckle* modules for fit_xsvs1. "ps" is Poisson distribution