chanter 0.0.3__tar.gz → 0.0.4__tar.gz

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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: chanter
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Galaxy spectral fitting
5
5
  Author: Struan Stevenson
6
6
  Author-email: struan.stevenson@ed.ac.uk
@@ -20,6 +20,7 @@ class galaxyfitter(object):
20
20
  model = modelgalaxy(fit_instruc)
21
21
  wavs, flux = model.get_spectrum()
22
22
  effwavs, phot = model.get_photometry(wavs, flux, filt_files)
23
+
23
24
  return phot
24
25
 
25
26
  # Liklihood function for a certain point in parameter space
@@ -73,14 +74,13 @@ class galaxyfitter(object):
73
74
  # Run fitter
74
75
  t0 = time.time()
75
76
 
76
- print('Computing '+str(id)+'...')
77
77
  # Load data
78
78
  dat= photdata.T
79
79
  dat[0] = 2.99792458E-05 * ((1e-6 * dat[0]) / ((effwavs)**2))
80
80
  dat[1] = 2.99792458E-05 * ((1e-6 * dat[1]) / ((effwavs)**2))
81
81
 
82
82
  # Run the nested sampler over the likelihood function
83
- sampler = Sampler(prior, lambda param_dict: self.log_likelihood(dat, self.gen_phot, filt_files, param_dict))
83
+ sampler = Sampler(prior, lambda param_dict: self.log_likelihood(dat, self.gen_phot, filt_files, param_dict), n_live=1000)
84
84
  success = sampler.run(verbose=True, discard_exploration=True, timeout=1800)
85
85
 
86
86
  # Plot results
@@ -50,7 +50,7 @@ def resample_igm_grid(wavs):
50
50
  hdul = fits.open(os.path.dirname(os.path.realpath(__file__)) + '/grids/ssps.fits')
51
51
  master_base = np.array((hdul[1].data, hdul[2].data, hdul[3].data, hdul[4].data, hdul[5].data, hdul[6].data, hdul[7].data))
52
52
 
53
- rest_target_wavs = np.arange(100., 50000., 10.)
53
+ rest_target_wavs = np.arange(100., 50000., 25.)
54
54
  grid = resample_ssp_wavs(rest_target_wavs)
55
55
  igm_grid = resample_igm_grid(rest_target_wavs)
56
56
 
@@ -225,22 +225,25 @@ class modelgalaxy(object):
225
225
 
226
226
  self.get_spectrum()
227
227
 
228
- ax.step(self.wavs, self.flux, **kwargs)
228
+ ax.plot(self.wavs, self.flux, **kwargs)
229
229
  ax.set_ylabel('Observed Flux / erg s$^{-1}$ cm$^{-2}$ Å$^{-1}$')
230
230
  ax.set_xlabel('Observed Wavelength / Å')
231
231
 
232
232
 
233
233
 
234
- def plot_sfh(self):
234
+ def plot_sfh(self, ax):
235
235
  ssp_age = grid[0].T[0, 1:]
236
236
  sfrs = self.sfr(ssp_age, self.fit_instructions["exponential"]["age"], self.fit_instructions["exponential"]["tau"], self.fit_instructions["exponential"]["massformed"])
237
- fig, ax = plt.subplots()
237
+
238
238
  ax.set_xlabel('Age / Gyr')
239
239
  ax.set_ylabel(' Star Formation / M$_{sun}$ Gyr$^{-1}$')
240
- ax.plot((self.universe_age-self.lookback_time) - ssp_age, sfrs/1e9, color='black')
240
+ ax.plot((self.universe_age-self.lookback_time) - ssp_age, sfrs/1e9, color='black', lw=1)
241
+ ax.axvline((self.universe_age-self.lookback_time) - ssp_age[0], 0, 1, color='black', ls='dashed', lw=1)
242
+
243
+ #ax.plot(-ssp_age, sfrs/1e9, color='black')
241
244
  ax.invert_xaxis()
245
+ ax.set_xlim(self.universe_age,0)
242
246
  ax.set_ylim(0, )
243
- return fig, ax
244
247
 
245
248
 
246
249
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: chanter
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Galaxy spectral fitting
5
5
  Author: Struan Stevenson
6
6
  Author-email: struan.stevenson@ed.ac.uk
@@ -4,7 +4,7 @@ from setuptools import setup
4
4
  setup(
5
5
  name='chanter',
6
6
 
7
- version='0.0.3',
7
+ version='0.0.4',
8
8
 
9
9
  description='Galaxy spectral fitting',
10
10
 
@@ -14,7 +14,7 @@ setup(
14
14
 
15
15
  packages= setuptools.find_packages(),
16
16
 
17
- #package_data = {'': ['*.txt', '*.fits'],},
17
+ package_data = {'': ['*.txt', '*.fits'],},
18
18
 
19
19
  install_requires=["numpy", "astropy", "matplotlib", "spectres", "nautilus-sampler"],
20
20
 
File without changes
File without changes
File without changes