Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple instances of function/variable ps for different purposes #60

Open
2 of 5 tasks
ambarb opened this issue Feb 9, 2021 · 1 comment
Open
2 of 5 tasks
Assignees
Labels
question V2 required to move towards share XPCS/speckle analysis for CHX/CSX

Comments

@ambarb
Copy link
Collaborator

ambarb commented Feb 9, 2021

"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_data comment on line 36
    ps =
  • instance 3b, get_pvlist_from_post internal variable that is returned
    ps =
  • instance 4, speckle modules with variable
    ps = Poission distribution. Docstring is good. no clarification needed

Instance 1

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()

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

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?
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

@ambarb ambarb added question V2 required to move towards share XPCS/speckle analysis for CHX/CSX labels Feb 9, 2021
@mrakitin
Copy link
Member

mrakitin commented Feb 10, 2021 via email

@ambarb ambarb changed the title when / how is ps used multiple instances of function/variable ps for different purposes Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question V2 required to move towards share XPCS/speckle analysis for CHX/CSX
Projects
None yet
Development

No branches or pull requests

4 participants