Commit 64a44b34 authored by Zhang Xin's avatar Zhang Xin
Browse files

disperse speed improve

parent baa82f5a
...@@ -53,7 +53,6 @@ def disperse_grism_object(np.ndarray[FTYPE_t, ndim=2] flam, ...@@ -53,7 +53,6 @@ def disperse_grism_object(np.ndarray[FTYPE_t, ndim=2] flam,
nk = len(idxl) nk = len(idxl)
nl = len(full) nl = len(full)
yfrac_off = 1-yfrac
if (flat is not None): if (flat is not None):
nlamb = len(wlambda) nlamb = len(wlambda)
...@@ -92,7 +91,7 @@ def disperse_grism_object(np.ndarray[FTYPE_t, ndim=2] flam, ...@@ -92,7 +91,7 @@ def disperse_grism_object(np.ndarray[FTYPE_t, ndim=2] flam,
k2 = idxl[k]+(j-1)*shg[1]+i k2 = idxl[k]+(j-1)*shg[1]+i
if (k2 >= 0) & (k2 < nl): if (k2 >= 0) & (k2 < nl):
flat_ids = k2*nlamb+k flat_ids = k2*nlamb+k
full[k2] += fl_ij*yfrac_off[k]*flat_eff_all[flat_ids] full[k2] += fl_ij*(1-yfrac[k])*flat_eff_all[flat_ids]
else: else:
for i in range(0-x0[1], x0[1]): for i in range(0-x0[1], x0[1]):
...@@ -110,11 +109,11 @@ def disperse_grism_object(np.ndarray[FTYPE_t, ndim=2] flam, ...@@ -110,11 +109,11 @@ def disperse_grism_object(np.ndarray[FTYPE_t, ndim=2] flam,
for k in range(nk): for k in range(nk):
k1 = idxl[k]+j*shg[1]+i k1 = idxl[k]+j*shg[1]+i
if (k1 >= 0) & (k1 < nl): if (k1 >= 0) & (k1 < nl):
full[k1] += fl_ij*yfrac[k]*ysens[k] full[k1] += ysens[k]*fl_ij*yfrac[k]
k2 = idxl[k]+(j-1)*shg[1]+i k2 = idxl[k]+(j-1)*shg[1]+i
if (k2 >= 0) & (k2 < nl): if (k2 >= 0) & (k2 < nl):
full[k2] += fl_ij*yfrac_off[k]*ysens[k] full[k2] += ysens[k]*fl_ij*(1-yfrac[k])
return True return True
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment