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_mci_sim
Commits
cd939224
Commit
cd939224
authored
Jan 23, 2025
by
Yan Zhaojun
Browse files
update
parent
f6a0c574
Pipeline
#7858
passed with stage
in 0 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
csst_mci_sim/support/sed.py
View file @
cd939224
...
@@ -121,42 +121,42 @@ def calibrate(wave, flux, mag, path, band='GAIA_bp'):
...
@@ -121,42 +121,42 @@ def calibrate(wave, flux, mag, path, band='GAIA_bp'):
# SED Template
# SED Template
# class Gal_Temp():
class
Gal_Temp
():
# """
"""
# Template of Galaxy SED
Template of Galaxy SED
# """
"""
# def __init__(self, log, path):
# #
# # parent = os.path.dirname(os.path.realpath(__file__))
# self.path = path
# hdulist = fits.open(
# self.path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits')
# if len(hdulist) < 4:
# log.error(
# 'Data error in galaxy_temp.fits file, please check!!!')
# raise ValueError(
# 'Data error in galaxy_temp.fits file, please check!!!')
# self.wave = hdulist[1].data['wave']
# self.flux = hdulist[2].data
# self.age_grid = hdulist[3].data['logAge']
# self.feh_grid = hdulist[3].data['FeH']
# def toMag(self, redshift=0):
def
__init__
(
self
,
log
,
path
):
# """Calculating magnitude
# Args:
#
# redshift (float, optional): redshift of spectra. Defaults to 0.
# """
# parent = os.path.dirname(os.path.realpath(__file__))
# wave = self.wave * (1 + redshift)
self
.
path
=
path
# self.umag = flux_to_mag(wave, self.flux, self.path, band='SDSS_u')
hdulist
=
fits
.
open
(
# self.gmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_g')
self
.
path
+
'MCI_inputData/SED_Code/seddata/galaxy_temp.fits'
)
# self.rmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_r')
# self.imag = flux_to_mag(wave, self.flux, self.path, band='SDSS_i')
if
len
(
hdulist
)
<
4
:
# self.zmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_z')
log
.
error
(
'Data error in galaxy_temp.fits file, please check!!!'
)
raise
ValueError
(
'Data error in galaxy_temp.fits file, please check!!!'
)
self
.
wave
=
hdulist
[
1
].
data
[
'wave'
]
self
.
flux
=
hdulist
[
2
].
data
self
.
age_grid
=
hdulist
[
3
].
data
[
'logAge'
]
self
.
feh_grid
=
hdulist
[
3
].
data
[
'FeH'
]
def
toMag
(
self
,
redshift
=
0
):
"""Calculating magnitude
Args:
redshift (float, optional): redshift of spectra. Defaults to 0.
"""
wave
=
self
.
wave
*
(
1
+
redshift
)
self
.
umag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_u'
)
self
.
gmag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_g'
)
self
.
rmag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_r'
)
self
.
imag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_i'
)
self
.
zmag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_z'
)
# class Star_Temp():
# class Star_Temp():
...
...
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