Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-sims
csst_msc_sim
Commits
d920a33e
Commit
d920a33e
authored
Jun 25, 2023
by
Zhang Xin
Browse files
fix bug sls: spec shift along y direction
parent
966f2132
Changes
2
Hide whitespace changes
Inline
Side-by-side
ObservationSim/MockObject/SpecDisperser/SpecDisperser.py
View file @
d920a33e
...
...
@@ -122,7 +122,7 @@ class SpecDisperser(object):
beam
=
beam
)
### Account for pixel centering of the trace
yfrac_beam
=
ytrace_beam
-
floor
(
ytrace_beam
)
yfrac_beam
=
ytrace_beam
-
floor
(
ytrace_beam
+
0.5
)
ysens
=
lam_beam
*
0
lam_index
=
argsort
(
lam_beam
)
...
...
@@ -155,7 +155,7 @@ class SpecDisperser(object):
sensitivity_beam
=
ysens
len_spec_x
=
len
(
dx
)
len_spec_y
=
int
(
ceil
(
y
f
rac_beam
[
-
1
])
-
floor
(
y
f
rac_beam
[
0
])
+
1
)
len_spec_y
=
int
(
ceil
(
y
t
rac
e
_beam
[
-
1
])
-
floor
(
y
t
rac
e
_beam
[
0
])
+
1
)
beam_sh
=
(
self
.
img_sh
[
0
]
+
len_spec_y
,
self
.
img_sh
[
1
]
+
len_spec_x
)
modelf
=
zeros
(
product
(
beam_sh
),
dtype
=
float
)
...
...
@@ -165,9 +165,15 @@ class SpecDisperser(object):
dxpix
=
dx
-
dx
[
0
]
+
x0
[
1
]
dyc
=
cast
[
int
](
ytrace_beam
)
dyc
=
cast
[
int
](
np
.
floor
(
ytrace_beam
+
0.5
))
dypix
=
cast
[
int
](
np
.
floor
(
ytrace_beam
-
dyc
[
0
]
+
x0
[
0
]
+
0.5
))
frac_ids
=
yfrac_beam
<
0
dypix
[
frac_ids
]
=
dypix
[
frac_ids
]
-
1
yfrac_beam
[
frac_ids
]
=
1
+
yfrac_beam
[
frac_ids
]
dypix
=
dyc
-
dyc
[
0
]
+
x0
[
0
]
flat_index
=
idx
[
dypix
,
dxpix
]
nonz
=
sensitivity_beam
!=
0
...
...
@@ -185,7 +191,7 @@ class SpecDisperser(object):
origin_in
[
1
]
=
self
.
origin
[
1
]
dx0_in
=
dx
[
0
]
dy0_in
=
dyc
[
0
]
originOut_x
=
origin_in
[
1
]
+
dx0_in
originOut_x
=
origin_in
[
1
]
+
dx0_in
originOut_y
=
origin_in
[
0
]
+
dy0_in
if
self
.
flat_cube
is
None
:
...
...
ObservationSim/MockObject/SpecDisperser/disperse_c/disperse.pyx
View file @
d920a33e
...
...
@@ -86,12 +86,12 @@ def disperse_grism_object(np.ndarray[FTYPE_t, ndim=2] flam,
k1
=
idxl
[
k
]
+
j
*
shg
[
1
]
+
i
if
(
k1
>=
0
)
&
(
k1
<
nl
):
flat_ids
=
k1
*
nlamb
+
k
full
[
k1
]
+=
fl_ij
*
yfrac
[
k
]
*
flat_eff_all
[
flat_ids
]
full
[
k1
]
+=
fl_ij
*
(
1
-
yfrac
[
k
]
)
*
flat_eff_all
[
flat_ids
]
k2
=
idxl
[
k
]
+
(
j
-
1
)
*
shg
[
1
]
+
i
k2
=
idxl
[
k
]
+
(
j
+
1
)
*
shg
[
1
]
+
i
if
(
k2
>=
0
)
&
(
k2
<
nl
):
flat_ids
=
k2
*
nlamb
+
k
full
[
k2
]
+=
fl_ij
*
(
1
-
yfrac
[
k
]
)
*
flat_eff_all
[
flat_ids
]
full
[
k2
]
+=
fl_ij
*
yfrac
[
k
]
*
flat_eff_all
[
flat_ids
]
else
:
for
i
in
range
(
0
-
x0
[
1
],
x0
[
1
]):
...
...
@@ -109,11 +109,11 @@ def disperse_grism_object(np.ndarray[FTYPE_t, ndim=2] flam,
for
k
in
range
(
nk
):
k1
=
idxl
[
k
]
+
j
*
shg
[
1
]
+
i
if
(
k1
>=
0
)
&
(
k1
<
nl
):
full
[
k1
]
+=
ysens
[
k
]
*
fl_ij
*
yfrac
[
k
]
full
[
k1
]
+=
ysens
[
k
]
*
fl_ij
*
(
1
-
yfrac
[
k
]
)
k2
=
idxl
[
k
]
+
(
j
-
1
)
*
shg
[
1
]
+
i
k2
=
idxl
[
k
]
+
(
j
+
1
)
*
shg
[
1
]
+
i
if
(
k2
>=
0
)
&
(
k2
<
nl
):
full
[
k2
]
+=
ysens
[
k
]
*
fl_ij
*
(
1
-
yfrac
[
k
]
)
full
[
k2
]
+=
ysens
[
k
]
*
fl_ij
*
yfrac
[
k
]
return
True
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment