In [28]:
from chxanalys.chx_packages import *
%matplotlib notebook
plt.rcParams.update({'figure.max_open_warning': 0})
plt.rcParams.update({ 'image.origin': 'lower'   })
plt.rcParams.update({ 'image.interpolation': 'none'   })
import pickle as cpk
from chxanalys.chx_xpcs_xsvs_jupyter_V1 import *

from eiger_io.pims_reader import EigerImages

In [2]:
CYCLE= '2017_2'  #change clycle here
username =  getpass.getuser()
 
 
data_dir0  = create_user_folder(CYCLE, username)
print( data_dir0 )


Results from this analysis will be stashed in the directory /XF11ID/analysis/2017_2/yuzhang/Results/
/XF11ID/analysis/2017_2/yuzhang/Results/

In [13]:
data_dir = os.path.join(data_dir0, 'Yang_Pressure/')
os.makedirs(data_dir, exist_ok=True)
print('Results from this analysis will be stashed in the directory %s' % data_dir)


Results from this analysis will be stashed in the directory /XF11ID/analysis/2017_2/yuzhang/Results/Yang_Pressure/

In [14]:
uid = '748501' #(scan num: 3203) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa )

In [15]:
md = get_meta_data( uid )
imgs = load_data( uid, md['detector'], reverse= True  )
md.update( imgs.md );Nimg = len(imgs);
#if 'number of images'  not in list(md.keys()):
md['number of images']  = Nimg
pixel_mask =  1- np.int_( np.array( imgs.md['pixel_mask'], dtype= bool)  )
print( 'The data are: %s' %imgs )

md['acquire period' ] = md['cam_acquire_period']
md['exposure time'] =  md['cam_acquire_time']


The data are: Sliced and/or processed EigerImages2. Original repr:
    <Frames>
    Length: 1800 frames
    Frame Shape: 2167 x 2070
    Pixel Datatype: uint32

In [16]:
center = [   md['beam_center_x'], 2167 - md['beam_center_y']]  # center of the speckle pattern, read from [image_x, image_y], ((not python y,x))
#Or change to something else:
#center = [  x, y ]
center=[center[0], center[1]]
inc_x0 =  center[1]
inc_y0=   center[0]

uidstr = 'uid=xxx' 

dpix, lambda_, Ldet,  exposuretime, timeperframe, center = check_lost_metadata(
    md, Nimg, inc_x0 = inc_x0, inc_y0=   inc_y0, pixelsize = 7.5*10*(-5) )

timeperframe = md['acquire period' ]

setup_pargs=dict(uid=uidstr, dpix= dpix, Ldet=Ldet, lambda_= lambda_, exposuretime=exposuretime,
        timeperframe=timeperframe, center=center, path= data_dir)

print_dict( setup_pargs )


uid--> uid=xxx
Ldet--> 4917.50495
exposuretime--> 0.99999
lambda_--> 1.28454
dpix--> 0.0750000035623
center--> [988, 1120]
timeperframe--> 1.0
path--> /XF11ID/analysis/2017_2/yuzhang/Results/Yang_Pressure/

In [ ]:


In [17]:
mask_path = '/XF11ID/analysis/2017_2/masks/'
# mask_name = 'July18_mask.npy' #smaller than 160 C use this one
mask_name = 'Jul5_SAXS.npy' #>= 160 C use this one

In [18]:
mask = load_mask(mask_path, mask_name, plot_ =  False, image_name = uidstr + '_mask', reverse= True ) 
mask *= pixel_mask
show_img(mask,image_name = uidstr + '_mask', save=True, path=data_dir, aspect=1)



In [ ]:


In [ ]:


In [ ]:
p=1.47 GPa

uid=1afc83
uid=1393d2 (center)
uid= 48e966

p= 2.53 GPa P'=3.0 GPa
1 ['171cf5'] (scan num: 3160) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (center)
 1 ['171cf5'] (scan num: 3160) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (30 micron away)

P= 3.3 GPa
1 ['178f11'] (scan num: 3169) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (center)
1 ['e4ada9'] (scan num: 3170) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (30 micron away)

P=3.94 GPa 4.5 GPa
1 ['9b08ff'] (scan num: 3180) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (center)
1 ['9bea6f'] (scan num: 3181) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (30 micron-away)

P=5.08 GPa (5.38 GPa)
1 ['293961'] (scan num: 3194) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (center)
 1 ['af5b4a'] (scan num: 3195) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (30 microns away)

p=6.27 GPa
1 ['398940'] (scan num: 3202) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (center)
1 ['748501'] (scan num: 3203) (Measurement: XPCS -1.8K frames, 1 Hz: Bi2212, Pressure 1GPa ) (50 microns away) (unprocessed)

In [104]:
uids = { 'p=1.47': [ '1afc83', '1393d2', '48e966'],
        'p=2.53':  [ '171cf5', ],
        'p=3.30': ['178f11', 'e4ada9'],     
        'p=3.94': ['9b08ff', '9bea6fcb'],
        'p=5.08': ['293961', 'af5b4a'],
        'p=6.27':  ['398940','748501']             
       
       }

In [105]:
#uids = {        'p=1.47': [ '1afc83', '1393d2', '48e966']  }

In [ ]:


In [107]:
uids


Out[107]:
{'p=1.47': ['1afc83', '1393d2', '48e966'],
 'p=2.53': ['171cf5'],
 'p=3.30': ['178f11', 'e4ada9'],
 'p=3.94': ['9b08ff', '9bea6fcb'],
 'p=5.08': ['293961', 'af5b4a'],
 'p=6.27': ['398940', '748501']}

In [87]:
%run ~/chxanalys_link/chxanalys/chx_generic_functions.py

In [98]:
%run ~/chxanalys_link/chxanalys/chx_xpcs_xsvs_jupyter_V1.py

In [99]:
#validate_uid_dict(  uids  )

In [100]:
setup_pargs['filename'] = 'qIq_Pressure_July16_2017.csv'

In [101]:
setup_pargs


Out[101]:
{'Ldet': 4917.50495,
 'center': [988, 1120],
 'dpix': 0.075000003562308848,
 'exposuretime': 0.99998999,
 'filename': 'qIq_Pressure_July16_2017.csv',
 'lambda_': 1.2845441,
 'path': '/XF11ID/analysis/2017_2/yuzhang/Results/Yang_Pressure/',
 'timeperframe': 1.0,
 'uid': 'uid=48e966'}

In [108]:
pd = get_iq_from_uids(  uids, mask, setup_pargs )


Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_178f113a-73d3-4f7a-b74a-b70faa98726b.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_e4ada9bc-9b73-4b69-a3e6-c1454d320309.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_398940a8-301a-4abb-b2e7-ed5d409eb574.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_74850141-0c99-4bbe-a5ea-797238a12ee1.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_1afc83df-8068-4a4e-8a0f-0cf2a42d6c46.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_1393d28e-045c-4155-893a-e31664936302.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_48e9662d-e470-4a9e-bcc9-eefec3714dfb.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_29396191-a9a1-401f-a439-bc697253d74d.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_af5b4ac1-ecef-41be-a820-67983f050b9d.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_171cf5dd-2cb1-4ef8-a004-8f3f383ec1ea.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_9b08ff72-e448-42a0-ad45-aef976e80db1.cmp.
Using already created compressed file with filename as :/XF11ID/analysis/Compressed_Data/uid_9bea6fcb-693d-4e86-899b-4903dc15f3b0.cmp.
The file: qIq_Pressure_July16_2017.csv is saved in /XF11ID/analysis/2017_2/yuzhang/Results/Yang_Pressure/

In [ ]:


In [ ]:


In [109]:
pd


Out[109]:
q p=3.30_178f11 p=3.30_e4ada9 p=6.27_398940 p=6.27_748501 p=1.47_1afc83 p=1.47_1393d2 p=1.47_48e966 p=5.08_293961 p=5.08_af5b4a p=2.53_171cf5 p=3.94_9b08ff p=3.94_9bea6fcb
0 0.002275 15.455789 12.975201 1.993653 5.142322 2.477678 3.786749 1.558173 1.544737 9.268142 13.121362 5.541827 6.428204
1 0.002350 10.714612 8.670416 2.140388 4.118310 5.131579 10.615582 3.798324 1.562133 4.504654 10.219377 4.369197 4.997632
2 0.002425 8.759825 7.315244 1.688148 3.329016 4.733236 13.421871 3.659133 1.298645 3.289942 8.686335 3.857027 4.355848
3 0.002499 8.201193 6.752368 1.448351 2.716263 3.765526 10.823237 2.791596 1.165982 2.541675 8.314570 3.595289 4.078211
4 0.002574 8.166600 6.095270 1.241743 2.429587 3.227632 8.824196 2.310846 0.971686 2.165533 7.532489 3.299573 3.717333
5 0.002648 7.321115 5.616946 1.095457 2.038837 2.749688 7.843075 2.028989 0.905859 1.874598 7.063760 3.094771 3.492458
6 0.002723 6.856778 5.320901 0.977076 1.782269 2.232123 6.623918 1.797170 0.862404 1.648503 6.676520 2.921567 3.297830
7 0.002798 6.540526 4.985439 0.968567 1.661164 2.101292 6.020310 1.525743 0.751854 1.574333 6.380877 2.771351 3.114023
8 0.002872 6.027218 4.553543 0.824883 1.541565 1.806875 4.935935 1.346715 0.678125 1.337627 5.940724 2.589417 2.912890
9 0.002947 5.658698 4.328135 0.837405 1.518749 1.542147 4.385208 1.177359 0.614806 1.280388 5.687590 2.450152 2.788324
10 0.003021 5.216523 4.069986 0.710517 1.408539 1.444102 4.016645 1.082458 0.556344 1.211034 5.437777 2.313816 2.647077
11 0.003096 4.765397 3.851896 0.707757 1.395050 1.236992 3.502072 0.949933 0.532406 1.106759 5.173634 2.201249 2.531449
12 0.003171 4.466400 3.581631 0.684326 1.200530 1.121675 3.229844 0.879797 0.479478 1.027795 4.861507 2.075423 2.383465
13 0.003245 4.303263 3.518200 0.601596 1.175137 1.035611 3.294467 0.783554 0.440284 0.925411 4.644989 1.982386 2.296954
14 0.003320 3.975903 3.237038 0.601437 1.058947 0.928460 2.594221 0.721657 0.428247 0.887440 4.431967 1.880092 2.180626
15 0.003394 3.744667 3.195789 0.546663 1.031045 0.863348 2.496265 0.694656 0.388246 0.811334 4.234295 1.805029 2.099137
16 0.003469 3.482048 2.972216 0.528326 0.966192 0.792321 2.213966 0.626224 0.386059 0.724914 4.038335 1.734540 2.007657
17 0.003544 3.265303 2.763454 0.505234 0.874263 0.735336 2.085516 0.571398 0.358247 0.684638 3.881227 1.656003 1.909658
18 0.003618 3.168759 2.669857 0.474743 0.870400 0.670423 1.842883 0.540226 0.336942 0.601659 3.627769 1.590120 1.842597
19 0.003693 2.943846 2.458882 0.478809 0.749205 0.615855 1.951539 0.488404 0.329717 0.563908 3.515076 1.525942 1.754972
20 0.003767 2.761982 2.367554 0.435760 0.744358 0.562041 1.604613 0.448566 0.302658 0.520720 3.318633 1.439447 1.681721
21 0.003842 2.623355 2.188547 0.424838 0.679189 0.512015 1.478163 0.413728 0.307346 0.496606 3.186472 1.382056 1.609663
22 0.003917 2.549510 2.074258 0.425924 0.647080 0.489051 1.336683 0.379597 0.297080 0.474740 3.061601 1.325386 1.548712
23 0.003991 2.324518 2.005887 0.399388 0.648363 0.449237 1.293433 0.362471 0.283762 0.446923 2.880195 1.278438 1.499003
24 0.004066 2.232449 1.858361 0.402870 0.595424 0.407115 1.245005 0.326053 0.282779 0.430216 2.777857 1.228937 1.439551
25 0.004140 2.105107 1.787654 0.371173 0.596050 0.389195 1.161611 0.310901 0.265127 0.410864 2.643689 1.177657 1.382042
26 0.004215 2.012967 1.662500 0.366660 0.568533 0.351859 1.103885 0.281892 0.269493 0.407560 2.531163 1.134962 1.326847
27 0.004290 1.905145 1.589759 0.365586 0.560697 0.331436 1.062993 0.282500 0.265147 0.391237 2.422963 1.094917 1.276818
28 0.004364 1.802551 1.506552 0.351711 0.557904 0.313390 0.966597 0.251530 0.258142 0.385740 2.309262 1.055818 1.232681
29 0.004439 1.710910 1.418343 0.349100 0.519514 0.293996 0.880049 0.231258 0.256027 0.376653 2.214174 1.017453 1.182965
... ... ... ... ... ... ... ... ... ... ... ... ... ...
1564 0.118928 0.001202 0.001018 0.001298 0.001553 0.001851 0.001851 0.001526 0.001149 0.001184 0.001167 0.000605 0.000649
1565 0.119003 0.001145 0.000886 0.001191 0.001496 0.002161 0.001505 0.001376 0.001127 0.001339 0.001283 0.000628 0.000619
1566 0.119077 0.001044 0.001061 0.001272 0.001333 0.001921 0.001754 0.001561 0.001061 0.001237 0.001289 0.000719 0.000860
1567 0.119152 0.001281 0.000993 0.001082 0.001579 0.001847 0.001787 0.001321 0.001053 0.001212 0.001321 0.000715 0.000765
1568 0.119226 0.000947 0.000880 0.001340 0.001560 0.001799 0.001847 0.001416 0.001206 0.001282 0.001321 0.000603 0.000555
1569 0.119301 0.001168 0.000789 0.001263 0.001663 0.001926 0.001716 0.001242 0.001179 0.001179 0.001232 0.000684 0.000600
1570 0.119376 0.001153 0.000806 0.001198 0.001523 0.002049 0.001747 0.001299 0.001209 0.001422 0.001489 0.000594 0.000649
1571 0.119450 0.001085 0.000977 0.001310 0.001504 0.001762 0.001643 0.001343 0.001128 0.001246 0.001353 0.000644 0.000720
1572 0.119525 0.001028 0.000881 0.001408 0.001493 0.001922 0.001787 0.001579 0.001346 0.001040 0.001285 0.000514 0.000820
1573 0.119599 0.000936 0.000947 0.001076 0.001485 0.001825 0.002000 0.001439 0.001076 0.001240 0.001591 0.000737 0.000585
1574 0.119674 0.001066 0.000947 0.001105 0.001395 0.001868 0.001895 0.001395 0.001158 0.001382 0.001355 0.000579 0.000750
1575 0.119748 0.000996 0.000768 0.001209 0.001863 0.001593 0.001707 0.001579 0.001038 0.001394 0.001209 0.000569 0.000725
1576 0.119823 0.001342 0.000921 0.001316 0.001684 0.001974 0.002039 0.001724 0.001092 0.001289 0.001382 0.000632 0.000750
1577 0.119897 0.001070 0.001002 0.001273 0.001324 0.001630 0.001613 0.001375 0.001222 0.001307 0.001290 0.000543 0.000866
1578 0.119972 0.001068 0.001023 0.001414 0.001654 0.001850 0.001714 0.001564 0.001263 0.000962 0.001398 0.000737 0.000947
1579 0.120047 0.001053 0.000877 0.001368 0.001614 0.002070 0.001754 0.001175 0.001070 0.001193 0.001263 0.000649 0.000860
1580 0.120121 0.001111 0.000975 0.001033 0.001579 0.002125 0.002008 0.001540 0.001072 0.001345 0.001657 0.000702 0.000604
1581 0.120196 0.001316 0.001165 0.001297 0.001711 0.002068 0.001654 0.001541 0.000940 0.001391 0.001485 0.000395 0.000827
1582 0.120270 0.000842 0.001011 0.001221 0.001663 0.002042 0.001663 0.001453 0.000947 0.001053 0.001263 0.000568 0.000905
1583 0.120345 0.001003 0.000852 0.001404 0.001579 0.002155 0.002180 0.001504 0.001128 0.000902 0.001529 0.000576 0.000677
1584 0.120419 0.001373 0.001007 0.001236 0.001350 0.002174 0.001854 0.001442 0.001144 0.001190 0.001190 0.000686 0.000686
1585 0.120494 0.001298 0.001228 0.001368 0.002105 0.001895 0.001930 0.001719 0.001053 0.001123 0.001439 0.000456 0.000807
1586 0.120568 0.001136 0.000776 0.001191 0.002438 0.002133 0.002216 0.001468 0.001108 0.001219 0.001385 0.000554 0.000942
1587 0.120643 0.000940 0.000865 0.001391 0.001992 0.002068 0.001729 0.001617 0.001278 0.001278 0.001579 0.000489 0.000789
1588 0.120717 0.001360 0.001096 0.001140 0.001667 0.002018 0.001798 0.001491 0.001667 0.001623 0.001754 0.000702 0.001009
1589 0.120792 0.001228 0.001491 0.001360 0.001711 0.002018 0.002281 0.002193 0.001535 0.002149 0.001316 0.001053 0.000877
1590 0.120867 0.001316 0.000614 0.001579 0.001404 0.002018 0.002193 0.002018 0.001491 0.001316 0.001404 0.001316 0.000789
1591 0.120941 0.001462 0.001813 0.001345 0.001637 0.001754 0.002339 0.001754 0.000994 0.001871 0.001404 0.001170 0.000526
1592 0.121016 0.001579 0.001579 0.001053 0.001930 0.002281 0.003333 0.001579 0.001228 0.002807 0.002281 0.000702 0.000877
1593 0.121090 0.002456 0.002105 0.001053 0.003158 0.003158 0.001579 0.001404 0.001930 0.001579 0.001930 0.000526 0.001053

1594 rows × 13 columns


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: