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_ifs_sim
Commits
2310a47d
Commit
2310a47d
authored
Oct 28, 2024
by
Yan Zhaojun
Browse files
update
parent
dee9e0bb
Pipeline
#7143
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
csst_ifs_sim/csst_ifs_sim.py
View file @
2310a47d
...
@@ -2505,11 +2505,8 @@ class IFSsimulator():
...
@@ -2505,11 +2505,8 @@ class IFSsimulator():
# zone 2
# zone 2
self
.
image_r
[
1536
:
3072
,
3072
:
6144
]
+=
self
.
information
[
'exptime'
]
*
\
self
.
image_r
[
1536
:
3072
,
3072
:
6144
]
+=
self
.
information
[
'exptime'
]
*
\
self
.
information
[
'dark4_r'
]
self
.
information
[
'dark4_r'
]
# #############################################################################
# #############################################################################
def
applyPoissonNoise
(
self
):
def
applyPoissonNoise
(
self
):
"""
"""
...
@@ -3251,7 +3248,6 @@ class IFSsimulator():
...
@@ -3251,7 +3248,6 @@ class IFSsimulator():
self
.
image_b
=
np
.
rint
(
self
.
image_b
).
astype
(
int
)
self
.
image_b
=
np
.
rint
(
self
.
image_b
).
astype
(
int
)
self
.
log
.
info
(
'Maximum and total values of the image are %i and %i, respectively'
%
(
np
.
max
(
self
.
image_b
),
self
.
log
.
info
(
'Maximum and total values of the image are %i and %i, respectively'
%
(
np
.
max
(
self
.
image_b
),
np
.
sum
(
self
.
image_b
)))
np
.
sum
(
self
.
image_b
)))
# avoid negative numbers in case bias level was not added
# avoid negative numbers in case bias level was not added
self
.
image_r
[
self
.
image_r
<
0.0
]
=
0.
self
.
image_r
[
self
.
image_r
<
0.0
]
=
0.
# cut of the values larger than max
# cut of the values larger than max
...
@@ -3261,62 +3257,46 @@ class IFSsimulator():
...
@@ -3261,62 +3257,46 @@ class IFSsimulator():
self
.
log
.
info
(
'Maximum and total values of the image are %i and %i, respectively'
%
(
np
.
max
(
self
.
image_r
),
self
.
log
.
info
(
'Maximum and total values of the image are %i and %i, respectively'
%
(
np
.
max
(
self
.
image_r
),
np
.
sum
(
self
.
image_r
)))
np
.
sum
(
self
.
image_r
)))
# ############################################################################
# ############################################################################
# def applyImageShift(self):
# def applyImageShift(self):
# """
# """
# Returns
# Returns
# -------
# -------
# None.
# None.
# """
# """
# np.random.seed(9*self.simnumber)
# np.random.seed(9*self.simnumber)
# ud = np.random.random() # Choose a random rotation
# ud = np.random.random() # Choose a random rotation
# dx = 2 * (ud-0.5) * self.information['shiftmax']
# dx = 2 * (ud-0.5) * self.information['shiftmax']
# np.random.seed(99*self.simnumber)
# np.random.seed(99*self.simnumber)
# ud = np.random.random() # Choose a random rotation
# ud = np.random.random() # Choose a random rotation
# dy = 2 * (ud-0.5) * self.information['shiftmax']
# dy = 2 * (ud-0.5) * self.information['shiftmax']
# self.image_b = ndimage.shift(self.image_b.copy(), [
# self.image_b = ndimage.shift(self.image_b.copy(), [
# dy+self.information['shift_b_y'], dx+self.information['shift_b_x']], order=0, mode='nearest')
# dy+self.information['shift_b_y'], dx+self.information['shift_b_x']], order=0, mode='nearest')
# self.image_r = ndimage.shift(self.image_r.copy(), [
# self.image_r = ndimage.shift(self.image_r.copy(), [
# dy+self.information['shift_r_y'], dx+self.information['shift_r_x']], order=0, mode='nearest')
# dy+self.information['shift_r_y'], dx+self.information['shift_r_x']], order=0, mode='nearest')
# self.log.info('Applied image shifting to g r i channels.')
# self.log.info('Applied image shifting to g r i channels.')
# self.information['ra'] = dx*self.information['pixel_size']
# self.information['ra'] = dx*self.information['pixel_size']
# self.information['dec'] = dy*self.information['pixel_size']
# self.information['dec'] = dy*self.information['pixel_size']
##############################################################################
##############################################################################
# def applyImageRotate(self):
# def applyImageRotate(self):
# """
# """
# Returns
# Returns
# -------
# -------
# None.
# None.
# """
# """
# np.random.seed(10*self.simnumber)
# np.random.seed(10*self.simnumber)
# ud = np.random.random() # Choose a random rotation
# ud = np.random.random() # Choose a random rotation
# angle = 2 * (ud-0.5) * self.information['tel_rotmax']
# angle = 2 * (ud-0.5) * self.information['tel_rotmax']
# inputimg = self.image_b.copy()
# inputimg = self.image_b.copy()
# # here we choose reshape=False, the rotated image will
# # here we choose reshape=False, the rotated image will
# rotimg = ndimage.rotate(
# rotimg = ndimage.rotate(
# inputimg, angle+self.information['rotate_b'], order=1, reshape=False)
# inputimg, angle+self.information['rotate_b'], order=1, reshape=False)
# self.image_b = rotimg
# self.image_b = rotimg
# inputimg = self.image_r.copy()
# inputimg = self.image_r.copy()
# # here we choose reshape=False, the rotated image will
# # here we choose reshape=False, the rotated image will
# rotimg = ndimage.rotate(
# rotimg = ndimage.rotate(
# inputimg, angle+self.information['rotate_r'], order=1, reshape=False)
# inputimg, angle+self.information['rotate_r'], order=1, reshape=False)
# self.image_r = rotimg
# self.image_r = rotimg
# self.information['Tel_rot'] = angle
# self.information['Tel_rot'] = angle
# self.log.info(
# self.log.info(
# 'Applied telescope rotation with angle (in degree)= %f.', angle)
# 'Applied telescope rotation with angle (in degree)= %f.', angle)
###############################################################################
###############################################################################
...
@@ -3326,7 +3306,6 @@ class IFSsimulator():
...
@@ -3326,7 +3306,6 @@ class IFSsimulator():
Returns
Returns
-------
-------
None.
None.
"""
"""
imgb
=
self
.
image_b
.
copy
()
imgb
=
self
.
image_b
.
copy
()
prescan
=
int
(
self
.
information
[
'prescan'
])
prescan
=
int
(
self
.
information
[
'prescan'
])
...
...
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