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
3351be22
Commit
3351be22
authored
Oct 26, 2024
by
Wei Chengliang
Browse files
update codestyle-PEP8
parent
8fd9723d
Changes
8
Show whitespace changes
Inline
Side-by-side
observation_sim/mock_objects/Quasar.py
View file @
3351be22
...
@@ -98,7 +98,7 @@ class Quasar(MockObject):
...
@@ -98,7 +98,7 @@ class Quasar(MockObject):
del
self
.
sed
del
self
.
sed
def
getGSObj
(
self
,
psf
,
g1
=
0
,
g2
=
0
,
flux
=
None
,
filt
=
None
,
tel
=
None
,
exptime
=
150.
):
def
getGSObj
(
self
,
psf
,
g1
=
0
,
g2
=
0
,
flux
=
None
,
filt
=
None
,
tel
=
None
,
exptime
=
150.
):
if
flux
==
None
:
if
flux
is
None
:
flux
=
self
.
getElectronFluxFilt
(
filt
,
tel
,
exptime
)
flux
=
self
.
getElectronFluxFilt
(
filt
,
tel
,
exptime
)
qso
=
galsim
.
Gaussian
(
sigma
=
1.e-8
,
flux
=
1.
)
qso
=
galsim
.
Gaussian
(
sigma
=
1.e-8
,
flux
=
1.
)
qso
=
qso
.
withFlux
(
flux
)
qso
=
qso
.
withFlux
(
flux
)
...
...
observation_sim/mock_objects/Stamp.py
View file @
3351be22
...
@@ -21,7 +21,7 @@ class Stamp(MockObject):
...
@@ -21,7 +21,7 @@ class Stamp(MockObject):
del
self
.
sed
del
self
.
sed
def
drawObj_multiband
(
self
,
tel
,
pos_img
,
psf_model
,
bandpass_list
,
filt
,
chip
,
nphotons_tot
=
None
,
g1
=
0
,
g2
=
0
,
exptime
=
150.
,
fd_shear
=
None
):
def
drawObj_multiband
(
self
,
tel
,
pos_img
,
psf_model
,
bandpass_list
,
filt
,
chip
,
nphotons_tot
=
None
,
g1
=
0
,
g2
=
0
,
exptime
=
150.
,
fd_shear
=
None
):
if
nphotons_tot
==
None
:
if
nphotons_tot
is
None
:
nphotons_tot
=
self
.
getElectronFluxFilt
(
filt
,
tel
,
exptime
)
nphotons_tot
=
self
.
getElectronFluxFilt
(
filt
,
tel
,
exptime
)
try
:
try
:
...
...
observation_sim/mock_objects/Star.py
View file @
3351be22
...
@@ -22,7 +22,7 @@ class Star(MockObject):
...
@@ -22,7 +22,7 @@ class Star(MockObject):
del
self
.
sed
del
self
.
sed
def
getGSObj
(
self
,
psf
,
g1
=
0
,
g2
=
0
,
flux
=
None
,
filt
=
None
,
tel
=
None
,
exptime
=
150.
):
def
getGSObj
(
self
,
psf
,
g1
=
0
,
g2
=
0
,
flux
=
None
,
filt
=
None
,
tel
=
None
,
exptime
=
150.
):
if
flux
==
None
:
if
flux
is
None
:
flux
=
self
.
getElectronFluxFilt
(
filt
,
tel
,
exptime
)
flux
=
self
.
getElectronFluxFilt
(
filt
,
tel
,
exptime
)
# star = galsim.Gaussian(sigma=1.e-8, flux=1.)
# star = galsim.Gaussian(sigma=1.e-8, flux=1.)
star
=
galsim
.
DeltaFunction
()
star
=
galsim
.
DeltaFunction
()
...
@@ -35,7 +35,7 @@ class Star(MockObject):
...
@@ -35,7 +35,7 @@ class Star(MockObject):
raise
ValueError
(
raise
ValueError
(
"!!!The number of PSF profiles and the number of bandpasses must be equal."
)
"!!!The number of PSF profiles and the number of bandpasses must be equal."
)
objs
=
[]
objs
=
[]
if
nphotons_tot
==
None
:
if
nphotons_tot
is
None
:
nphotons_tot
=
self
.
getElectronFluxFilt
(
filt
,
tel
,
exptime
)
nphotons_tot
=
self
.
getElectronFluxFilt
(
filt
,
tel
,
exptime
)
try
:
try
:
...
...
observation_sim/mock_objects/_util.py
View file @
3351be22
tests/test_SpecDisperse.py
View file @
3351be22
...
@@ -428,8 +428,8 @@ class TestSpecDisperse(unittest.TestCase):
...
@@ -428,8 +428,8 @@ class TestSpecDisperse(unittest.TestCase):
plt
.
xlim
(
6200
,
10000
)
plt
.
xlim
(
6200
,
10000
)
plt
.
ylim
(
1
,
4
)
plt
.
ylim
(
1
,
4
)
plt
.
yscale
(
'log'
)
plt
.
yscale
(
'log'
)
plt
.
xlabel
(
'$\lambda$'
)
plt
.
xlabel
(
r
'$\lambda$'
)
plt
.
ylabel
(
'$F\lambda$'
)
plt
.
ylabel
(
r
'$F\lambda$'
)
plt
.
legend
([
'one spec'
,
'split in 8000 A'
])
plt
.
legend
([
'one spec'
,
'split in 8000 A'
])
plt
.
show
()
plt
.
show
()
...
...
tests/test_Straylight.py
View file @
3351be22
...
@@ -192,7 +192,7 @@ class TestStraylight(unittest.TestCase):
...
@@ -192,7 +192,7 @@ class TestStraylight(unittest.TestCase):
plt
.
figure
()
plt
.
figure
()
plt
.
plot
(
spec
[
'WAVELENGTH'
],
spec
[
'FLUX'
],
'r'
)
plt
.
plot
(
spec
[
'WAVELENGTH'
],
spec
[
'FLUX'
],
'r'
)
plt
.
xlabel
(
'WAVELENGTH'
)
plt
.
xlabel
(
'WAVELENGTH'
)
plt
.
ylabel
(
'F$\lambda$(erg/s/cm2/A/arcsec2)'
)
plt
.
ylabel
(
r
'F$\lambda$(erg/s/cm2/A/arcsec2)'
)
plt
.
xlim
(
2000
,
10000
)
plt
.
xlim
(
2000
,
10000
)
plt
.
show
()
plt
.
show
()
median
=
np
.
median
(
sl_e_pix
[
0
:
tnum
])
median
=
np
.
median
(
sl_e_pix
[
0
:
tnum
])
...
...
tests/test_darknoise_func.py
View file @
3351be22
...
@@ -10,11 +10,11 @@ import yaml
...
@@ -10,11 +10,11 @@ import yaml
from
observation_sim.instruments
import
Chip
,
Filter
,
FilterParam
,
FocalPlane
from
observation_sim.instruments
import
Chip
,
Filter
,
FilterParam
,
FocalPlane
##
# test FUNCTION --- START ###
# test FUNCTION --- START ###
def
get_base_img
(
img
,
chip
,
read_noise
,
readout_time
,
dark_noise
,
exptime
=
150.
,
InputDark
=
None
):
def
get_base_img
(
img
,
chip
,
read_noise
,
readout_time
,
dark_noise
,
exptime
=
150.
,
InputDark
=
None
):
if
InputDark
==
None
:
if
InputDark
is
None
:
# base_level = read_noise**2 + dark_noise*(exptime+0.5*readout_time)
# base_level = read_noise**2 + dark_noise*(exptime+0.5*readout_time)
# base_level = dark_noise*(exptime+0.5*readout_time)
# base_level = dark_noise*(exptime+0.5*readout_time)
base_level
=
dark_noise
*
(
exptime
)
base_level
=
dark_noise
*
(
exptime
)
...
@@ -31,7 +31,7 @@ def get_base_img(img, chip, read_noise, readout_time, dark_noise, exptime=150.,
...
@@ -31,7 +31,7 @@ def get_base_img(img, chip, read_noise, readout_time, dark_noise, exptime=150.,
base_img2
[
ny
:,
:]
=
arr
[::
-
1
,
:]
base_img2
[
ny
:,
:]
=
arr
[::
-
1
,
:]
base_img2
[:,
:]
=
base_img2
[:,
:]
*
(
readout_time
/
ny
)
*
dark_noise
base_img2
[:,
:]
=
base_img2
[:,
:]
*
(
readout_time
/
ny
)
*
dark_noise
return
base_img1
+
base_img2
return
base_img1
+
base_img2
##
# test FUNCTION --- END ###
# test FUNCTION --- END ###
def
defineCCD
(
iccd
,
config_file
):
def
defineCCD
(
iccd
,
config_file
):
...
...
tools/target_location_check.py
View file @
3351be22
...
@@ -221,8 +221,8 @@ def ccdLayout(xpixTar, ypixTar, figout="ccdLayout.pdf"):
...
@@ -221,8 +221,8 @@ def ccdLayout(xpixTar, ypixTar, figout="ccdLayout.pdf"):
ax
.
text
(
ix0
+
500
,
iy0
+
1500
,
"%s#%s"
%
ax
.
text
(
ix0
+
500
,
iy0
+
1500
,
"%s#%s"
%
(
fType
,
ischip
),
fontsize
=
12
,
color
=
"grey"
)
(
fType
,
ischip
),
fontsize
=
12
,
color
=
"grey"
)
ax
.
plot
(
xpixTar
,
ypixTar
,
"r*"
,
ms
=
12
)
ax
.
plot
(
xpixTar
,
ypixTar
,
"r*"
,
ms
=
12
)
ax
.
set_xlabel
(
"$X\,[\mathrm{pixels}]$"
,
fontsize
=
20
)
ax
.
set_xlabel
(
r
"$X\,[\mathrm{pixels}]$"
,
fontsize
=
20
)
ax
.
set_ylabel
(
"$Y\,[\mathrm{pixels}]$"
,
fontsize
=
20
)
ax
.
set_ylabel
(
r
"$Y\,[\mathrm{pixels}]$"
,
fontsize
=
20
)
ax
.
invert_yaxis
()
ax
.
invert_yaxis
()
ax
.
axis
(
'off'
)
ax
.
axis
(
'off'
)
plt
.
savefig
(
figout
)
plt
.
savefig
(
figout
)
...
...
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