Skip to content

Commit

Permalink
Merge branch 'feature/iva-plotting-forreal' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ivalaginja committed Jun 19, 2019
2 parents 61440d9 + 3408ec0 commit 6c991d5
Show file tree
Hide file tree
Showing 17 changed files with 458 additions and 263 deletions.
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
[![MIT License][license-shield]][license-url]
![Python version][python-version-url]

<img src="logo.png" align="left" />

# HST marginalization - NEWNAME
# ExoTiC-ISM
**Exoplanet Timeseries Characterisation - Instrument Systematic Marginalisation**

This code performs Levenberg-Marquardt least-squares minimization across a grid of stochastic systematic models to produce marginalized transit parameters given a lightcurve for a specified wavelength range.
This code performs Levenberg-Marquardt least-squares minimization across a grid of stochastic systematic models to produce marginalised transit parameters given a lightcurve for a specified wavelength range.

This was developed and tested for data from Wide Field Camera 3 (WFC3) on the Hubble Space Telescope (HST), specifically with the G141 spectroscopic grism, as published in Wakeford et al. (2016, ApJ, 819, 1). Future work includes plans to extend this to other WFC3 grids, STIS data, and eventually data from the James Webb Space Telescope (JWST).

This code follows the method outlined in Wakeford, et al. (2016), using marginalization across a stochastic grid of models. The program makes use of the analytic transit model in Mandel & Agol (2002, ApJ Letters, 580, L171-175) and a Levenberg-Marquardt least squares minimization using [Sherpa](https://sherpa.readthedocs.io/en/latest/), a Python package for modeling and fitting data. The transit model uses a 4-parameter limb darkening law, as outlined in Claret (2010) and Sing et al. (2010).
This code follows the method outlined in Wakeford, et al. (2016), using marginalisation across a stochastic grid of models. The program makes use of the analytic transit model in Mandel & Agol (2002, ApJ Letters, 580, L171-175) and a Levenberg-Marquardt least squares minimization using [Sherpa](https://sherpa.readthedocs.io/en/latest/), a Python package for modeling and fitting data. The transit model uses a 4-parameter limb darkening law, as outlined in Claret (2010) and Sing et al. (2010).

This package was built from the original IDL code used for the analysis in Wakeford et al. (2016), initially translated by Matthew Hill and then further adapted and transformed into a full astronomy Python package by Iva Laginja.
This package was built from the original IDL code used for the analysis in Wakeford et al. (2016), initially translated by Matthew Hill and then further adapted and transformed into a full astronomy Python package with the help of Iva Laginja.

Note how this is not an installable package, but you will always need to clone it if you want to work with it.

Expand All @@ -25,9 +27,9 @@ This section will you give all the necessary terminal commands to go from openin
reduced results on your local machine. For a more thorough description of the individual steps, please continue to the section
**Prerequisites** and beyond.

We assume that you have `conda` and `git` installed.
We assume that you have `conda` and `git` installed and that you're using `bash`.

- Create the `hstmarg` environment:
- Create the `exoticism` environment:
```bash
$ conda env create --file environment.yml
```
Expand All @@ -42,7 +44,7 @@ $ cd /User/YourUser/repos/
$ git clone https://github.com/hrwakeford/HST_Marginalization.git
```

- Copy the file `config.ini`, name the copy `config_local.ini` and add the line `config_local.ini` into your `.gitignore`.
- Copy the file `config.ini` and name the copy `config_local.ini`.

- Open your local configfile `config_loca.ini` and edit the entries `[data_paths][local_path]` to point to your local repo clone, e.g.:
```ini
Expand All @@ -59,7 +61,7 @@ output_path = /Users/YourUser/<path-to-data>

- Navigate to inside the actual package:
```bash
$ cd HST_python
$ cd exotic-ism
```

- Run the marginalization on the demo data from the template:
Expand All @@ -75,7 +77,7 @@ specified under `[data_paths][output_path]` in your `config_local.ini`!
We highly recommend the usage of the package and environment manager [Conda](https://docs.conda.io/projects/conda/en/latest/index.html),
which is free and runs on Windows, macOS and Linux. We have included an [environment](environment.yml) file in our repository
from which you can directly build a new conda environment in which we have tested our package. We developed and tested our
package with **Python 3.6.8** in **conda 4.6.7**.
package with **Python 3.7.3** in **conda 4.6.7**.

Run

Expand All @@ -98,19 +100,18 @@ however, is version controlled, and the paths to local directories will get mess
file; you might also lose the changes you made to the parameters. This is why config.ini is supposed to be used as a **TEMPLATE**.

In order to make it work for you, copy `config.ini` and rename the copy to `config_local.ini`. In this **local configfile**,
you can set all your parameters, and it will override the config.ini at runtime. **Make sure you add `config_local.ini` to
your `.gitignore` file!**
you can set all your parameters, and it will override the config.ini at runtime.

### Output data

The relevant data files and plots from your run will be saved to the directory you specify under **`output_path`** in your
local configfile. *This data will be overwritten with every new run*, so make sure to move or rename results you want to
keep permanently.
keep permanently, or alternatively, define a new output path for new data under `[data_paths] -> output_path`.

### Changing data or the parameters

We provide demo data for the exoplanet WASP-17b, which is one of the datasets analyzed in Wakeford et al. (2016).
Currently we only support the marginalization of WFC3/G141 datasets. If you want to perform the marginalization on a different
Currently we only support the marginalisation of WFC3/G141 datasets. If you want to perform the marginalization on a different
transit dataset, you have to add it to the data folder and update the planetary parameters in your local configfile.

**The configfile** has the following structure, except here we added some extra comments for clarity:
Expand All @@ -120,23 +121,23 @@ local_path = /Users/MyUser/repos/HST-Marginalization ; your global path to the
data_path = data ; local path to the input data
output_path = /Users/MyUser/data ; global path ot the output directory
current_model = W17 ; data selection; refers to section in configfile
run_name = testing ; suffix for output data

[limb_darkening]
ld_model = 3D
metallicity = -1.0
Teff = 6550
logg = 4.5
ld_model = 3D ; 3D or 2D limb darkening model
metallicity = -1.0 ; star metallicity
Teff = 6550 ; star effective temperaturs
logg = 4.5 ; log gravity of star

[system_parameters]
instrument = WFC3
grating = G141
grid_selection = fit_time
run_name = wl_time_wm3d

[technical_parameters]
plotting = True
outlier_limit_std = 3.
errors = hessian ; error method to be used, "hessian" or "confidence"
errors = hessian ; error method to be used, "hessian" or "confidence"

[smooth_model]
resolution = 0.0001
Expand Down Expand Up @@ -174,7 +175,7 @@ Please read [CONTRIBUTING.md]() for details on our code of conduct, and the proc

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.txt) file for details
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.txt) file for details.

## Acknowledgments

Expand Down
136 changes: 47 additions & 89 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,106 +4,64 @@
# or
# ``conda env create --name <myEnvName> --file environment.yml``


name: hstmarg
name: exoticism
channels:
- sherpa
- http://ssb.stsci.edu/astroconda
- defaults
dependencies:
- astropy=3.1.2=py36h1de35cc_0
- atomicwrites=1.3.0=py36_1
- attrs=19.1.0=py36_1
- astropy=3.2.1=py37h1de35cc_0
- atomicwrites=1.3.0=py37_1
- attrs=19.1.0=py37_1
- blas=1.0=mkl
- ca-certificates=2019.1.23=0
- cycler=0.10.0=py36_0
- freetype=2.5.5=2
- icu=54.1=0
- ca-certificates=2019.5.15=0
- certifi=2019.3.9=py37_0
- cycler=0.10.0=py37_0
- freetype=2.9.1=hb4e5f40_0
- importlib_metadata=0.17=py37_1
- intel-openmp=2019.4=233
- kiwisolver=1.1.0=py37h0a44026_0
- libcxx=4.0.1=hcfea43d_1
- libcxxabi=4.0.1=hcfea43d_1
- libedit=3.1.20181209=hb402a30_0
- libffi=3.2.1=h475c297_4
- libgfortran=3.0.1=h93005f0_2
- libpng=1.6.30=1
- matplotlib=2.0.2=np113py36_0
- mkl=2017.0.3=0
- more-itertools=6.0.0=py36_0
- libpng=1.6.37=ha441bb4_0
- matplotlib=3.1.0=py37h54f8f79_0
- mkl=2019.4=233
- mkl_fft=1.0.12=py37h5e564d8_0
- mkl_random=1.0.2=py37h27c97d8_0
- more-itertools=7.0.0=py37_0
- ncurses=6.1=h0a44026_1
- numpy=1.14.2=py36ha9ae307_0
- openssl=1.1.1b=h1de35cc_1
- pandas=0.20.3=py36_0
- pluggy=0.9.0=py36_0
- psutil=5.6.1=py36h1de35cc_0
- py=1.8.0=py36_0
- pyparsing=2.2.0=py36_0
- pyqt=5.6.0=py36_2
- pytest=4.3.1=py36_0
- pytest-arraydiff=0.3=py36h39e3cac_0
- pytest-astropy=0.5.0=py36_0
- pytest-doctestplus=0.3.0=py36_0
- pytest-openfiles=0.3.2=py36_0
- pytest-remotedata=0.3.1=py36_0
- python=3.6.8=haf84260_0
- python-dateutil=2.6.1=py36_0
- pytz=2017.2=py36_0
- qt=5.6.2=2
- numpy=1.16.4=py37hacdab7b_0
- numpy-base=1.16.4=py37h6575580_0
- openssl=1.1.1c=h1de35cc_1
- packaging=19.0=py37_0
- pandas=0.24.2=py37h0a44026_0
- pip=19.1.1=py37_0
- pluggy=0.12.0=py_0
- psutil=5.6.2=py37h1de35cc_0
- py=1.8.0=py37_0
- pyparsing=2.4.0=py_0
- pytest=4.6.2=py37_0
- pytest-arraydiff=0.3=py37h39e3cac_0
- pytest-astropy=0.5.0=py37_0
- pytest-doctestplus=0.3.0=py37_0
- pytest-openfiles=0.3.2=py37_0
- pytest-remotedata=0.3.1=py37_0
- python=3.7.3=h359304d_0
- python-dateutil=2.8.0=py37_0
- pytz=2019.1=py_0
- readline=7.0=h1de35cc_5
- scipy=0.19.1=np113py36_0
- setuptools=40.8.0=py36_0
- sip=4.18=py36_0
- six=1.12.0=py36_0
- sqlite=3.27.2=ha441bb4_0
- scipy=1.2.1=py37h1410ff5_0
- setuptools=41.0.1=py37_0
- sherpa=4.11.0=py37h0a44026_0
- six=1.12.0=py37_0
- sqlite=3.28.0=ha441bb4_0
- tk=8.6.8=ha441bb4_0
- wheel=0.33.1=py36_0
- tornado=6.0.2=py37h1de35cc_0
- wcwidth=0.1.7=py37_0
- wheel=0.33.4=py37_0
- xz=5.2.4=h1de35cc_4
- zlib=1.2.11=0
- pip:
- appnope==0.1.0
- backcall==0.1.0
- bleach==3.1.0
- certifi==2019.3.9
- chardet==3.0.4
- colorama==0.4.1
- decorator==4.4.0
- defusedxml==0.5.0
- entrypoints==0.3
- gitdb2==2.0.5
- gitpython==2.1.11
- idna==2.8
- ipykernel==5.1.0
- ipython==7.4.0
- ipython-genutils==0.2.0
- jedi==0.13.3
- jinja2==2.10
- jsonschema==3.0.1
- jupyter-client==5.2.4
- jupyter-core==4.4.0
- markupsafe==1.1.1
- mgefit==5.0.12
- mistune==0.8.4
- nbconvert==5.4.1
- nbdime==1.0.5
- nbformat==4.4.0
- notebook==5.7.6
- pandocfilters==1.4.2
- parso==0.3.4
- pexpect==4.6.0
- pickleshare==0.7.5
- pip==19.0.3
- prometheus-client==0.6.0
- prompt-toolkit==2.0.9
- ptyprocess==0.6.0
- pygments==2.3.1
- pyrsistent==0.14.11
- pyzmq==18.0.1
- requests==2.21.0
- send2trash==1.5.0
- sherpa==4.11.0
- smmap2==2.0.5
- terminado==0.8.1
- testpath==0.4.2
- tornado==6.0.2
- traitlets==4.3.2
- urllib3==1.24.1
- wcwidth==0.1.7
- webencodings==0.5.1

- zipp=0.5.1=py_0
- zlib=1.2.11=h1de35cc_3
File renamed without changes.
2 changes: 1 addition & 1 deletion HST_python/config.ini → exotic-ism/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local_path = /Users/MyUser/repos/HST-Marginalization
data_path = data
output_path = /Users/MyUser/data
current_model = W17
run_name = _testing

[limb_darkening]
ld_model = 3D
Expand All @@ -18,7 +19,6 @@ logg = 4.5
instrument = WFC3
grating = G141
grid_selection = fit_time
run_name = wl_time_wm3d

[technical_parameters]
plotting = True
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
This is a self-standing module that calculates limb darkening parameters for either 1D or 3D stellar models. It
returns the parameteres for 4D, 3D, 2D and 1D limb darkening models.
returns the parameters for 4D, 3D, 2D and 1D limb darkening models.
"""

import os
Expand Down
Loading

0 comments on commit 6c991d5

Please sign in to comment.