chanter 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chanter/__init__.py +4 -0
- chanter/galaxy_fitter.py +118 -0
- chanter/model_galaxy.py +257 -0
- chanter/utils/__init__.py +1 -0
- chanter/utils/filter_set.py +175 -0
- chanter/utils/make_igm_grid.py +234 -0
- chanter/utils/make_ssp_grid/ascii_files/bintoascii.py +9 -0
- chanter/utils/make_ssp_grid/csv_to_fits.py +24 -0
- chanter/utils/make_ssp_grid/get_ssp.py +32 -0
- chanter/utils/make_ssp_grid/load_fits_test.py +8 -0
- chanter/utils/make_ssp_grid/raw_files/bc03/src/rebuildfitsheader.py +625 -0
- chanter/utils/make_ssp_grid/raw_files/bc03/src/rebuildtimeheader.py +48 -0
- chanter-0.0.1.dist-info/METADATA +14 -0
- chanter-0.0.1.dist-info/RECORD +16 -0
- chanter-0.0.1.dist-info/WHEEL +5 -0
- chanter-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Rebuilds headers of BC/CB model fits file
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
import warnings
|
|
7
|
+
from astropy.table import Table
|
|
8
|
+
from astropy.io import fits
|
|
9
|
+
from astropy.utils.exceptions import AstropyWarning
|
|
10
|
+
|
|
11
|
+
# Read fits table with BC models
|
|
12
|
+
with fits.open(str(sys.argv[1])) as hdul:
|
|
13
|
+
warnings.simplefilter('ignore', category=AstropyWarning)
|
|
14
|
+
#f = Table.read(hdul,hdu=1) # hdu = 1 => SED's (luminosity vs. wavelength)
|
|
15
|
+
#p = Table.read(hdul,hdu=2) # hdu = 2 => galaxy physical properties
|
|
16
|
+
#m = Table.read(hdul,hdu=3) # hdu = 3 => photometric magnitude in different bands
|
|
17
|
+
#d = Table.read(hdul,hdu=4) # hdu = 4 => line spectral indices
|
|
18
|
+
t = Table.read(hdul,hdu=5) # hdu = 5 => time scale for spectral evolution (221 steps)
|
|
19
|
+
t = t['age-yr'] # time scale without pre MS evolution (agrees with t for BC03 and C&B models)
|
|
20
|
+
|
|
21
|
+
print("# Build fits compatible header for BINTABLE1 (model age)")
|
|
22
|
+
print()
|
|
23
|
+
print("sechdr = hdulist[1].header")
|
|
24
|
+
|
|
25
|
+
# Build fits compatible header for BINTABLE1 (model age)
|
|
26
|
+
sechdr = hdul[1].header
|
|
27
|
+
for i in range(len(t)+1):
|
|
28
|
+
if i==0:
|
|
29
|
+
s = 'Wavelength'
|
|
30
|
+
u = 'A (Wavelength)'
|
|
31
|
+
else:
|
|
32
|
+
c = t[i-1]
|
|
33
|
+
if c < 10.E9:
|
|
34
|
+
s = str('{:.5E}'.format(c))
|
|
35
|
+
else:
|
|
36
|
+
s = str('{:.4f}'.format(c*1.E-9)) + "E9"
|
|
37
|
+
s = s.replace("E+0", "E")
|
|
38
|
+
u = 'Lo/A (SED at t = ' + s + ' yr)'
|
|
39
|
+
s = s.replace(".", "p")
|
|
40
|
+
s = 't' + s
|
|
41
|
+
s = "sechdr['TTYPE" + str(i+1) + "'] = '" + s + "'" # label for column i+1
|
|
42
|
+
u = "sechdr['TUNIT" + str(i+1) + "'] = '" + u + "'" # units for column i+1
|
|
43
|
+
print(s)
|
|
44
|
+
print(u)
|
|
45
|
+
|
|
46
|
+
print()
|
|
47
|
+
print("# Write fits file")
|
|
48
|
+
print("hdulist.writeto('newdata.fits')")
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: chanter
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A very simple galaxy spectrum modeller
|
|
5
|
+
Author-email: Struan Stevenson <struan.stevenson@ed.ac.uk>
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: astropy
|
|
10
|
+
Requires-Dist: nautilus-sampler
|
|
11
|
+
Requires-Dist: spectres
|
|
12
|
+
Requires-Dist: matplotlib
|
|
13
|
+
|
|
14
|
+
# Chanter
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
chanter/__init__.py,sha256=BDOShvS6R5VpS_iI7FErrUklA9lD34k5ZoEtacycoIg,98
|
|
2
|
+
chanter/galaxy_fitter.py,sha256=JYDRc-iW5ZgDHprw4FCshrsBnG8ENvs3MEDNUtlFYxQ,3683
|
|
3
|
+
chanter/model_galaxy.py,sha256=3dWKJOcg7jbRtgJhxFREjGohZk4iXSDTvf6h0u-r5H8,7760
|
|
4
|
+
chanter/utils/__init__.py,sha256=hn-ho-lJeT0evKXL1tV5jX0cR4meSlJmPcdxC49cLok,34
|
|
5
|
+
chanter/utils/filter_set.py,sha256=EITLa2c3FG3n1-v7KatKRwHCRyfZ4TTjsi_WM7Bz64k,6819
|
|
6
|
+
chanter/utils/make_igm_grid.py,sha256=s9NeRmgOsj_OxvxXixIdPSSQZPlsLcPedIRr4soZUcU,10304
|
|
7
|
+
chanter/utils/make_ssp_grid/csv_to_fits.py,sha256=zPb4yFrpN9_YNuXwSIY7WJoknPpIx0tzhWYfCBtWvCw,1148
|
|
8
|
+
chanter/utils/make_ssp_grid/get_ssp.py,sha256=Rr-TaxYaW9BzuQ8i2X75XPwNKLq97h-kl7p3yXhS1aA,991
|
|
9
|
+
chanter/utils/make_ssp_grid/load_fits_test.py,sha256=rX5IN6hV_yN2dlNEdy5JsMnpxA1Dk-Tk2A8irvxqb2Q,183
|
|
10
|
+
chanter/utils/make_ssp_grid/ascii_files/bintoascii.py,sha256=y-AhZB_hi7K9aXbSMvojLEZDH61cE3itOKAJxl74sQ8,189
|
|
11
|
+
chanter/utils/make_ssp_grid/raw_files/bc03/src/rebuildfitsheader.py,sha256=aIWLJPcZIb0gBMd4vcruEATIc2s4bDojybu_dI2noYg,39734
|
|
12
|
+
chanter/utils/make_ssp_grid/raw_files/bc03/src/rebuildtimeheader.py,sha256=CBJR7Y-yieZUjMM4dXfBweYRGo7jyMZWKRPFJoUWlSs,1732
|
|
13
|
+
chanter-0.0.1.dist-info/METADATA,sha256=1c7_K054mlAGgHCi7xE5TBhfah9QHRQFNbjlOBGe7VI,359
|
|
14
|
+
chanter-0.0.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
15
|
+
chanter-0.0.1.dist-info/top_level.txt,sha256=Q23dLK1syz0D-XIZ6zeY6TOZ7BQsC-BLqRiVQE7_udk,8
|
|
16
|
+
chanter-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chanter
|