Skip to content

Commit

Permalink
Merge pull request #43 from mtakahiro/improvement-for-parameterizing-…
Browse files Browse the repository at this point in the history
…redshift

Improvement for parameterizing redshift
  • Loading branch information
mtakahiro authored Dec 29, 2022
2 parents 126413f + f11ad66 commit 0b5fbaf
Show file tree
Hide file tree
Showing 39 changed files with 1,793 additions and 1,518 deletions.
Binary file modified docs/_build/doctrees/auto/gsf.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/parameters.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/redshift_fitting.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/templates.doctree
Binary file not shown.
1 change: 1 addition & 0 deletions docs/_build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ gsf's documentation
fitting.rst
output.rst
prior.rst
redshift_fitting.rst

auto/modules

Expand Down
9 changes: 7 additions & 2 deletions docs/_build/html/_sources/parameters.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ An example config file can be generated by executing the following command (TBD)
- Comma separated list for spectral files. Path is relative to DIR_EXTR.
* - MORP
- str
- Profile shape, if grism spectra are provided. Will be used to convolve templates. "moffat", "gauss", or none.
- "moffat", "gauss", or none. Profile shape, if grism spectra are provided. Will be used to convolve templates.
* - MORP_FILE
- str
- Ascii file for morphology parameters.
Expand Down Expand Up @@ -136,6 +136,9 @@ An example config file can be generated by executing the following command (TBD)
* - AMIN
- str
- (Optional) Minimum value for amplitude, in normal logarithmic scale.
* - DUST_MODEL
- int
- Dust attenuation model (default 0). 0 for Calzetti. 1 for MW. 2 for LCM. 3 for SMC. 4 for Kriek & Conroy (2013).
* - AVMAX
- float
- (Optional) Maximum value for Av (dust attenuation in V-band), in mag.
Expand Down Expand Up @@ -170,8 +173,10 @@ An example config file can be generated by executing the following command (TBD)
-
-

Read :ref:`Redshift Fitting <redshift_fitting>` for a caveat about making redshift a free parameter.


**Parameters for a specific target:**
**Parameters specific for the target:**

.. list-table::
:widths: 10 5 20
Expand Down
22 changes: 22 additions & 0 deletions docs/_build/html/_sources/redshift_fitting.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. _redshift_fitting:

Redshift Fitting
================
While gsf is now able to search the redshift grid during the fiting process,
it was not originally designed to efficiently estimate the posterior for redshift.
Users can turn this redshift fitting functionality by turning ``F_ZMC`` to 1,
with ``ZMCMIN`` and ``ZMCMAX`` properly specified too, in the input configuration file.

To minimize the disk space usage, gsf generates templates only at ``ZMC`` specified in the input file.
How it works with redshift search is, during the fitting process, when gsf detects a large shift
(specifically, larger than the limiting value specified by ``deltaz_lim`` in `function_class`) in redshift from ``ZMC``,
gsf calls the filter convolution function (`function.filconv`) to recalculate the model broadband flux for the given model,
to better reflect the current place of each walker in the parameter space. ``ZMC`` is also replaced to this new redshift at
this point. When the shift is small, gsf interpolates the model fluxes for the given set of filters
after applying the shift to wavelength.

This extra step allows more accurate parameter search for gsf with redshift as a variable, but significantly slows down the computing speed, by a factor up to 10.
This overhead is primarily caused by the number of data points in the model templates and filter curves.
To minimize the computation time, users may want to consder using sparse templates, by using ``--delwave`` argument (delta wave, in Aungstrome) when they run run_gsf.py
script, or by directly passing the same parameter to `maketemp` function.

12 changes: 6 additions & 6 deletions docs/_build/html/_sources/templates.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ in the configuration file. The parameters are limited from the original fsps (`C
such as the range in metallicity, initial mass function (IMF), and ionizing parameter.

It is in this step that gsf generates templates of different ages and metallicities.
The templates are saved in a file, "spec\_all.asdf" (irrespective to object IDs),
The templates are saved in a file, ``spec_all.asdf`` (irrespective to object IDs),
which can be shared for other objects for the purpose of saving time.
Redshifted templates (below), which are actually
used in the fitting process, are generated by starting off from this common file.
Expand All @@ -34,22 +34,22 @@ If set to a negative value, then SSP is applied.

Shifting templates to the input redshift (Execution flag = 1)
-------------------------------------------------------------
In this step (specifically, `maketemp` module), gsf shifts the rest-frame templates generated above (i.e. those in "spec\_all.asdf")
In this step (specifically, `maketemp` module), gsf shifts the rest-frame templates generated above (i.e. those in ``spec_all.asdf``)
to the input redshift and calculates fluxes of the input filters for one-to-one comparison.
Basically, there are three steps;

- Redshift templates:

.. math::
\mathrm{wave_{obs}} = \mathrm{wave_{rest-frame}} (1 + z)
\mathrm{wave_{obs}} = \mathrm{wave_{rf}} (1 + z)
- Scaling flux:

.. math::
\mathrm{flux_{obs}} \propto \mathrm{flux_{rest-frame}} {4 \pi d_{L}^2 \over{(1+z)}}
\mathrm{flux_{obs}} \propto \mathrm{flux_{rf}} {4 \pi d_{L}^2 \over{(1+z)}}
where :math:`d_L` is luminosity distance to the input redshift.

Expand All @@ -61,6 +61,6 @@ where :math:`d_L` is luminosity distance to the input redshift.
\mathrm{flux_{atten}} = \mathrm{flux_{int}} \exp{(-\tau)}
where gsf applies the Madau model for IGM attenuation at :math:`z>6`.
where gsf applies `Dijkstra 2014 <https://ui.adsabs.harvard.edu/abs/2014PASA...31...40D/>`__ for IGM attenuation.

gsf will store the files generated here in a directory specified with ``DIR_TEMP``.
gsf will store the files generated here in the directory specified with ``DIR_TEMP``.
380 changes: 226 additions & 154 deletions docs/_build/html/auto/gsf.html

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/_build/html/auto/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="gsf package" href="gsf.html" />
<link rel="prev" title="Prior" href="../prior.html" />
<link rel="prev" title="Redshift Fitting" href="../redshift_fitting.html" />
</head>

<body class="wy-body-for-nav">
Expand Down Expand Up @@ -50,6 +50,7 @@
<li class="toctree-l1"><a class="reference internal" href="../fitting.html">Fitting process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../output.html">Output files</a></li>
<li class="toctree-l1"><a class="reference internal" href="../prior.html">Prior</a></li>
<li class="toctree-l1"><a class="reference internal" href="../redshift_fitting.html">Redshift Fitting</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">gsf</a><ul>
<li class="toctree-l2"><a class="reference internal" href="gsf.html">gsf package</a></li>
</ul>
Expand Down Expand Up @@ -115,7 +116,7 @@ <h1>gsf<a class="headerlink" href="#gsf" title="Permalink to this headline"><
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../prior.html" class="btn btn-neutral float-left" title="Prior" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../redshift_fitting.html" class="btn btn-neutral float-left" title="Redshift Fitting" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="gsf.html" class="btn btn-neutral float-right" title="gsf package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>

Expand Down
98 changes: 51 additions & 47 deletions docs/_build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<li class="toctree-l1"><a class="reference internal" href="fitting.html">Fitting process</a></li>
<li class="toctree-l1"><a class="reference internal" href="output.html">Output files</a></li>
<li class="toctree-l1"><a class="reference internal" href="prior.html">Prior</a></li>
<li class="toctree-l1"><a class="reference internal" href="redshift_fitting.html">Redshift Fitting</a></li>
<li class="toctree-l1"><a class="reference internal" href="auto/modules.html">gsf</a></li>
</ul>

Expand Down Expand Up @@ -88,7 +89,6 @@ <h1 id="index">Index</h1>
| <a href="#M"><strong>M</strong></a>
| <a href="#O"><strong>O</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#Q"><strong>Q</strong></a>
| <a href="#R"><strong>R</strong></a>
| <a href="#S"><strong>S</strong></a>
| <a href="#T"><strong>T</strong></a>
Expand All @@ -108,6 +108,8 @@ <h2 id="A">A</h2>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.minimizer.Minimizer.ampgo">ampgo() (gsf.minimizer.Minimizer method)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.apply_dust">apply_dust() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.minimizer.asteval_with_uncertainties">asteval_with_uncertainties() (in module gsf.minimizer)</a>
</li>
Expand Down Expand Up @@ -160,15 +162,19 @@ <h2 id="D">D</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.function.data_int">data_int() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.delta">delta() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.detect_line">detect_line() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.detect_line_man">detect_line_man() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.minimizer.Minimizer.dual_annealing">dual_annealing() (gsf.minimizer.Minimizer method)</a>
<li><a href="auto/gsf.html#gsf.function_igm.dijkstra_igm_abs">dijkstra_igm_abs() (in module gsf.function_igm)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.minimizer.Minimizer.dual_annealing">dual_annealing() (gsf.minimizer.Minimizer method)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.dust_calz">dust_calz() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.dust_gen">dust_gen() (in module gsf.function)</a>
Expand Down Expand Up @@ -242,12 +248,16 @@ <h2 id="G">G</h2>
<li><a href="auto/gsf.html#gsf.function.gauss">gauss() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.get_chi2">get_chi2() (in module gsf.function)</a>

<ul>
<li><a href="auto/gsf.html#gsf.zfit.get_chi2">(in module gsf.zfit)</a>
</li>
</ul></li>
<li><a href="auto/gsf.html#gsf.function_igm.get_column">get_column() (in module gsf.function_igm)</a>
</li>
<li><a href="auto/gsf.html#gsf.posterior_nested.Post_nested.get_dict">get_dict() (gsf.posterior_nested.Post_nested method)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.get_filt">get_filt() (in module gsf.function)</a>
<li><a href="auto/gsf.html#gsf.function_igm.get_dtdz">get_dtdz() (in module gsf.function_igm)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.get_Fint">get_Fint() (in module gsf.function)</a>
</li>
Expand All @@ -274,6 +284,8 @@ <h2 id="G">G</h2>
<li><a href="auto/gsf.html#gsf.function_igm.get_nH">get_nH() (in module gsf.function_igm)</a>
</li>
<li><a href="auto/gsf.html#gsf.writing.get_param">get_param() (in module gsf.writing)</a>
</li>
<li><a href="auto/gsf.html#gsf.posterior_flexible.Post.get_sfh_prior">get_sfh_prior() (gsf.posterior_flexible.Post method)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.get_SFMS">get_SFMS() (in module gsf.function)</a>
</li>
Expand All @@ -284,6 +296,30 @@ <h2 id="G">G</h2>
<li><a href="auto/gsf.html#gsf.maketmp_filt.get_spectrum_draine">get_spectrum_draine() (in module gsf.maketmp_filt)</a>
</li>
<li><a href="auto/gsf.html#gsf.function_class.Func.get_template">get_template() (gsf.function_class.Func method)</a>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.get_template">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
<li><a href="auto/gsf.html#gsf.function_class.Func.get_template_single">get_template_single() (gsf.function_class.Func method)</a>
</li>
<li><a href="auto/gsf.html#gsf.function_class.Func.get_total_flux">get_total_flux() (gsf.function_class.Func method)</a>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.get_total_flux">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
<li><a href="auto/gsf.html#gsf.function_class.Func.get_total_flux_neb">get_total_flux_neb() (gsf.function_class.Func method)</a>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.get_total_flux_neb">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.function.get_uvbeta">get_uvbeta() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.function_igm.get_XI">get_XI() (in module gsf.function_igm)</a>
</li>
<li><a href="auto/gsf.html#gsf.fitting.Mainbody.get_zdist">get_zdist() (gsf.fitting.Mainbody method)</a>
</li>
Expand All @@ -294,8 +330,6 @@ <h2 id="G">G</h2>
<li><a href="auto/gsf.html#module-gsf">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
gsf.basic_func

Expand Down Expand Up @@ -409,6 +443,8 @@ <h2 id="L">L</h2>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.posterior_nested.Post_nested.lnprob">lnprob() (gsf.posterior_nested.Post_nested method)</a>
</li>
<li><a href="auto/gsf.html#gsf.zfit.lnprob_cz">lnprob_cz() (in module gsf.zfit)</a>
</li>
<li><a href="auto/gsf.html#gsf.posterior_flexible.Post.lnprob_emcee">lnprob_emcee() (gsf.posterior_flexible.Post method)</a>
</li>
Expand Down Expand Up @@ -437,6 +473,8 @@ <h2 id="M">M</h2>
<li><a href="auto/gsf.html#gsf.maketmp_filt.maketemp">maketemp() (in module gsf.maketmp_filt)</a>
</li>
<li><a href="auto/gsf.html#gsf.maketmp_filt.maketemp_tau">maketemp_tau() (in module gsf.maketmp_filt)</a>
</li>
<li><a href="auto/gsf.html#gsf.function_igm.masongronke_igm_abs">masongronke_igm_abs() (in module gsf.function_igm)</a>
</li>
<li><a href="auto/gsf.html#gsf.minimizer.Minimizer.minimize">minimize() (gsf.minimizer.Minimizer method)</a>

Expand Down Expand Up @@ -499,26 +537,14 @@ <h2 id="O">O</h2>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.open_spec_dust_fits">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
<li><a href="auto/gsf.html#gsf.function_class.Func.open_spec_fits">open_spec_fits() (gsf.function_class.Func method)</a>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.open_spec_fits">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.function_class.Func.open_spec_fits_dir">open_spec_fits_dir() (gsf.function_class.Func method)</a>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.open_spec_fits_dir">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
<li><a href="auto/gsf.html#gsf.function_class.Func.open_spec_neb_fits">open_spec_neb_fits() (gsf.function_class.Func method)</a>
<li><a href="auto/gsf.html#gsf.function_class.Func.open_spec_fits">open_spec_fits() (gsf.function_class.Func method)</a>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.open_spec_neb_fits">(gsf.function_class.Func_tau method)</a>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.open_spec_fits">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
</ul></td>
Expand Down Expand Up @@ -548,14 +574,6 @@ <h2 id="P">P</h2>
</ul></td>
</tr></table>

<h2 id="Q">Q</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.fitting.Mainbody.quick_fit">quick_fit() (gsf.fitting.Mainbody method)</a>
</li>
</ul></td>
</tr></table>

<h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
Expand All @@ -578,6 +596,8 @@ <h2 id="R">R</h2>
</li>
</ul></li>
<li><a href="auto/gsf.html#gsf.posterior_nested.Post_nested.residual_nest">residual_nest() (gsf.posterior_nested.Post_nested method)</a>
</li>
<li><a href="auto/gsf.html#gsf.zfit.residual_z">residual_z() (in module gsf.zfit)</a>
</li>
<li><a href="auto/gsf.html#gsf.gsf.run_gsf_all">run_gsf_all() (in module gsf.gsf)</a>
</li>
Expand All @@ -601,17 +621,19 @@ <h2 id="S">S</h2>
</li>
<li><a href="auto/gsf.html#gsf.function.SFH_cons">SFH_cons() (in module gsf.function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.function.SFH_dec">SFH_dec() (in module gsf.function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.function.SFH_del">SFH_del() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.minimizer.Minimizer.shgo">shgo() (gsf.minimizer.Minimizer method)</a>
</li>
<li><a href="auto/gsf.html#gsf.minimizer.MinimizerResult.show_candidates">show_candidates() (gsf.minimizer.MinimizerResult method)</a>
</li>
<li><a href="auto/gsf.html#gsf.maketmp_filt.sim_spec">sim_spec() (in module gsf.maketmp_filt)</a>
</li>
<li><a href="auto/gsf.html#gsf.function.str2bool">str2bool() (in module gsf.function)</a>
</li>
<li><a href="auto/gsf.html#gsf.posterior_flexible.Post.swap_pars">swap_pars() (gsf.posterior_flexible.Post method)</a>
</li>
Expand All @@ -622,29 +644,11 @@ <h2 id="S">S</h2>

<h2 id="T">T</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.function_class.Func.tmp03">tmp03() (gsf.function_class.Func method)</a>
</li>
<li><a href="auto/gsf.html#gsf.function_class.Func.tmp03_neb">tmp03_neb() (gsf.function_class.Func method)</a>
</li>
<li><a href="auto/gsf.html#gsf.function_class.Func.tmp04">tmp04() (gsf.function_class.Func method)</a>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.tmp04">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="auto/gsf.html#gsf.function_class.Func.tmp04_dust">tmp04_dust() (gsf.function_class.Func method)</a>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.tmp04_dust">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
<li><a href="auto/gsf.html#gsf.function_class.Func.tmp04_neb">tmp04_neb() (gsf.function_class.Func method)</a>

<ul>
<li><a href="auto/gsf.html#gsf.function_class.Func_tau.tmp04_neb">(gsf.function_class.Func_tau method)</a>
</li>
</ul></li>
</ul></td>
Expand Down
2 changes: 2 additions & 0 deletions docs/_build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<li class="toctree-l1"><a class="reference internal" href="fitting.html">Fitting process</a></li>
<li class="toctree-l1"><a class="reference internal" href="output.html">Output files</a></li>
<li class="toctree-l1"><a class="reference internal" href="prior.html">Prior</a></li>
<li class="toctree-l1"><a class="reference internal" href="redshift_fitting.html">Redshift Fitting</a></li>
<li class="toctree-l1"><a class="reference internal" href="auto/modules.html">gsf</a></li>
</ul>

Expand Down Expand Up @@ -90,6 +91,7 @@ <h1>gsf’s documentation<a class="headerlink" href="#gsf-s-documentation" title
<li class="toctree-l1"><a class="reference internal" href="fitting.html">Fitting process</a></li>
<li class="toctree-l1"><a class="reference internal" href="output.html">Output files</a></li>
<li class="toctree-l1"><a class="reference internal" href="prior.html">Prior</a></li>
<li class="toctree-l1"><a class="reference internal" href="redshift_fitting.html">Redshift Fitting</a></li>
<li class="toctree-l1"><a class="reference internal" href="auto/modules.html">gsf</a></li>
</ul>
</div>
Expand Down
Binary file modified docs/_build/html/objects.inv
Binary file not shown.
Loading

0 comments on commit 0b5fbaf

Please sign in to comment.