Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
final[2,orre,:] = obj_S[orre,2,:][::-1]
tck = scipy.interpolate.splrep(blaze[0,orre,:],blaze[1,orre,:],k=3,s=0)
blin = scipy.interpolate.splev(final[0,orre,:],tck,der = 0)
final[3,orre,:] = final[1,orre,:]/blin
final[4,orre,:] = final[2,orre,:]*(blin**2)
X = final[0,orre,:]
Z = final[3,orre,:]
Z[:150] = 0.0
Z[-150:] = 0.0
I = np.isnan(Z)
Z[I] = 0.0
I = np.where(Z!=0)[0]
if len(I)>0:
cp = continuum.NORM_single(X,Z,orden=1)
ratio = np.polyval(cp,X)
else:
ratio = np.ones(len(X))
ratio = np.polyval(cp,X)
final[5,orre,:] = final[3,orre,:]/ratio
Inan = np.where( np.isnan(final[1,orre,:]) == True )[0]
final[5,orre,Inan] = 1.
final[6,orre,:] = final[4,orre,:]*(ratio**2)
final[7,orre,:] = ratio
final[8,orre,:] = ratio*blin / np.sqrt( ratio *blin / GAIN + (RON/GAIN)**2 )
spl = scipy.interpolate.splrep(np.arange(len(final[0,orre,:])),final[0,orre,:] ,k=3)
dlambda_dx = scipy.interpolate.splev(np.arange(len(final[0,orre,:])), spl, der=1)
NN = np.average(dlambda_dx)
dlambda_dx /= NN