Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def convert_QE(self):
"""Convert S(phi,eps) to S(Q,eps)"""
self.read_parameters()
Ei = self.Ei
dQ = self.dQ
dE = self.dE
pol, tof = centers(self.entry['data'].nxsignal, self.entry['data'].nxaxes)
en = self.convert_tof(tof)
idx_max = min(np.where(np.abs(en-0.75*Ei)<0.1)[0])
en = en[:idx_max]
data = self.entry['data'].nxsignal.nxdata[:,:idx_max]
if self.entry['data'].nxerrors:
errors = self.entry['data'].nxerrors.nxdata[:]
Q = np.zeros((len(pol), len(en)))
E = np.zeros((len(pol), len(en)))
for i in range(0,len(pol)):
p = pol[i]
Q[i,:] = np.array(np.sqrt((2*Ei - en - 2*np.sqrt(Ei*(Ei-en))
def convert_QE(self):
"""Convert S(phi,eps) to S(Q,eps)"""
self.read_parameters()
Ei = self.Ei
dQ = self.dQ
dE = self.dE
pol, tof = centers(self.entry['data'].nxsignal, self.entry['data'].nxaxes)
en = self.convert_tof(tof)
idx_max = min(np.where(np.abs(en-0.75*Ei)<0.1)[0])
en = en[:idx_max]
data = self.entry['data'].nxsignal.nxdata[:,:idx_max]
if self.entry['data'].nxerrors:
errors = self.entry['data'].nxerrors.nxdata[:]
Q = np.zeros((len(pol), len(en)))
E = np.zeros((len(pol), len(en)))
for i in range(0,len(pol)):
p = pol[i]
Q[i,:] = np.array(np.sqrt((2*Ei - en - 2*np.sqrt(Ei*(Ei-en))
def convert_QE(entry, dQ, dE):
"""Convert S(phi,eps) to S(Q,eps)"""
az = entry.data.azimuthal.nxdata[:]
pol = entry.data.polar.nxdata[:]
pol, en = centers(entry.data.nxsignal, entry.data.nxaxes)
data = entry.data.data.nxdata[:]
errors = entry.data.errors.nxdata[:]
Ei = entry.instrument.monochromator.incident_energy.nxdata
Q = np.zeros((len(pol), len(en)))
E = np.zeros((len(pol), len(en)))
for i in range(0,len(pol)):
for j in range(0,len(en)):
Q[i][j] = np.sqrt((2*Ei - en[j] - 2*np.sqrt(Ei*(Ei-en[j]))
* np.cos(pol[i]*np.pi/180.0))/2.0721)
E[i][j]=en[j]
s = Q.shape
Qin = Q.reshape(s[0]*s[1])