You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using the azimuthal integrator module for some GIWAXS data, where I am interested in studying the integrated data within a certain azimuthal range instead of the whole range. I find that whatever azimuthal range I use, the output data is the same, suggesting that it isn't correctly doing the azimuthal integration.
Below are the functions I use. I would like to be able to integrate the data properly for certain values of chi_pos and chi_width.
If anyone has any advice this would be much appreciated!
Thanks,
Esthy
defpyfai_1D(df, filename, qbins, chi_pos=0, chi_width=180, diagnostics=False,mask=False,maskfile='',rotate=False) :
filedf=df.loc[[filename]]
ifdiagnostics==True : print(filedf)
detector=pyFAI.detectors.Detector(
filedf.pixel_size[0], # pixel dimension x in mfiledf.pixel_size[0], # pixel dimension y in mmax_shape=(filedf.shape_x[0],filedf.shape_y[0]) # array size in pixels
)
ai=pyFAI.azimuthalIntegrator.AzimuthalIntegrator(
poni1= (filedf.shape_y[0]-filedf.beam_center_y[0])*filedf.pixel_size[0], # factoring in rotationponi2= (filedf.shape_x[0]-filedf.beam_center_x[0])*filedf.pixel_size[0], # factoring in rotation detector=detector,
rot2=np.deg2rad(filedf.twothet[0]),
wavelength=filedf.wavelength[0],
dist=filedf.distance[0]
)
pg=pygix.Transform()
pg.load(ai)
pg.incident_angle=filedf.incident_angle[0]
ifmask==True:
pg.maskfile=maskfileifdiagnostics==True :
print(ai)
sample_orientation=3pg.sample_orientation=sample_orientationimg=np.rot90(np.rot90(fabio.open(filedf.fileloc[0]).data))
qmin=0# minimum Q # 0.01 to 2.5qmax=2# maximum Qq, intensity=ai.integrate1d(img, npt=qbins, unit="q_A^-1", radial_range=(qmin, qmax), azimuth_range=(chi_pos-chi_width/2, chi_pos+chi_width/2), correctSolidAngle=True)
returnintensity,qdefmass_convert_1D_combine_pyfai(filedir, label='',chi_pos=0, chi_width=180, qbins=800, vmin=0, vmax=100, ymax=2, sqrt=False, combining=False, plotting=False) :
dtrek_files=glob.glob(filedir+'\*.img')
dtrek_files=sorted(dtrek_files)
vals=dtrek_vals(dtrek_files[0])
df=pd.DataFrame.from_dict(vals)
df=df.drop(0)
fordtrek_fileindtrek_files :
vals=dtrek_vals(dtrek_file)
df=df._append(pd.DataFrame.from_dict(vals)) #, index = 0, orient='columns', dtype=Nonedf=df.set_index('filename')
df_1D=pd.DataFrame()
ifcombining:
intensities= []
ifcombining==False:
fordtrek_fileindtrek_files :
filename=os.path.split(dtrek_file)[1]
print(f'Processing: {filename}\r', end="")
intensity, q=pyfai_1D(df, filename, qbins, diagnostics=False,mask=False,maskfile='',rotate=False)
df_1D["Q_"+filename] =q# /10 to angstrom if not in functiondf_1D["I_"+filename] =intensityplt.plot(q, intensity)
plt.xlabel('q (A^-1)')
plt.xlim(0.1,2.5)
plt.xticks(np.arange(0, 2.5, step=0.25))
plt.ylabel('Intensity')
plt.title(f'1D Integration for {filename}')
plt.show()
df_1D.to_csv(os.path.join(filedir,'1Dintegrations.csv'), index=False)
else:
fordtrek_fileindtrek_files :
filename=os.path.split(dtrek_file)[1]
print(f'Processing: {filename}\r', end="")
intensity,q=pyfai_1D(df, filename, qbins,diagnostics=False,mask=False,maskfile='',rotate=False)
df_1D["Q"] =q# /10 to angstrom if not in functionintensities.append(intensity)
GIarray=np.sum(intensities, axis=0)
df_1D["I"] =GIarrayfig,ax=plt.subplots(figsize=(10,6))
ax.plot(q, GIarray)
#ax.set_xscale('log')ax.xaxis.set_minor_formatter(ScalarFormatter())
ax.xaxis.set_major_formatter(ScalarFormatter())
plt.xlim(0.1,2)
#plt.xticks(np.arange(0, 2.5, step=0.25)) plt.xlabel('q (A$^{-1}$)')
plt.ylabel('Intensity')
plt.title(f'1D Integration for {filename}')
plt.show()
df_1D.to_csv(os.path.join(filedir,label+'1Dintegrations_combined.csv'), index=False)
The text was updated successfully, but these errors were encountered:
Hi Esthy, pygix did not receive much update for several years, thus Edgar ported most of its features directly into pyFAI.
Beside this, I see no issue.
Could you please print your "azimuth_range" and validate that it is correct ?
Dear all,
I have been using the azimuthal integrator module for some GIWAXS data, where I am interested in studying the integrated data within a certain azimuthal range instead of the whole range. I find that whatever azimuthal range I use, the output data is the same, suggesting that it isn't correctly doing the azimuthal integration.
Below are the functions I use. I would like to be able to integrate the data properly for certain values of chi_pos and chi_width.
If anyone has any advice this would be much appreciated!
Thanks,
Esthy
The text was updated successfully, but these errors were encountered: