Skip to content

Commit

Permalink
Merge pull request #511 from ExoCTK/develop
Browse files Browse the repository at this point in the history
Merging `develop` into `master` for `v1.2.2`
  • Loading branch information
nespinoza authored Jul 9, 2021
2 parents 44093bf + 0a23dda commit bb50f59
Show file tree
Hide file tree
Showing 38 changed files with 4,874 additions and 4,873 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ This file tracks all major changes in each `exoctk` release.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.2] - 2021-07-09

### Added

- Sweep to update code to match PEP8 standards.
- Extra authors on citation information to match current working DOI.

### Fixed

- Phase-constraint bug that didn't change `eccentricity` to `nan` when not found by the target resolver.

## [1.2.1] - 2021-06-09

Expand Down
50 changes: 27 additions & 23 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,33 +138,37 @@ If you use ExoCTK for work/research presented in a publication (whether directly

::

This research made use of the open source Python package exoctk, the Exoplanet Characterization Toolkit (Espinoza et al, 2021).
This research made use of the open source Python package exoctk, the Exoplanet Characterization Toolkit (Bourque et al, 2021).

where (Espinoza et al, 2021) is a citation of the Zenodo record, e.g.:
where (Bourque et al, 2021) is a citation of the Zenodo record, e.g.:

::

@software{nestor_espinoza_2021_4556063,
author = {Néstor Espinoza and
Matthew Bourque and
Joseph Filippazzo and
Michael Fox and
Jules Fowler and
Teagan King and
Catherine Martlin and
Jennifer Medina and
Mees Fix and
Kevin Stevenson and
Jeff Valenti},
title = {The Exoplanet Characterization Toolkit (ExoCTK)},
month = feb,
year = 2021,
publisher = {Zenodo},
version = {1.0.0},
doi = {10.5281/zenodo.4556063},
url = {https://doi.org/10.5281/zenodo.4556063}
}

@software{matthew_bourque_2021_4556063,
author = {Matthew Bourque and
Néstor Espinoza and
Joseph Filippazzo and
Mees Fix and
Teagan King and
Catherine Martlin and
Jennifer Medina and
Natasha Batalha and
Michael Fox and
Jules Fowler and
Jonathan Fraine and
Matthew Hill and
Nikole Lewis and
Kevin Stevenson and
Jeff Valenti and
Hannah Wakeford},
title = {The Exoplanet Characterization Toolkit (ExoCTK)},
month = feb,
year = 2021,
publisher = {Zenodo},
version = {1.0.0},
doi = {10.5281/zenodo.4556063},
url = {https://doi.org/10.5281/zenodo.4556063}
}

Want to stay up-to-date with our releases and updates?
------------------------------------------------------
Expand Down
44 changes: 22 additions & 22 deletions exoctk/atmospheric_retrievals/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,20 @@ def example(method):

# Fit for the stellar radius and planetary mass using Gaussian priors. This
# is a way to account for the uncertainties in the published values
pw.fit_info.add_gaussian_fit_param('Rs', 0.02*R_sun)
pw.fit_info.add_gaussian_fit_param('Mp', 0.04*M_jup)
pw.fit_info.add_gaussian_fit_param('Rs', 0.02 * R_sun)
pw.fit_info.add_gaussian_fit_param('Mp', 0.04 * M_jup)

# Fit for other parameters using uniform priors
pw.fit_info.add_uniform_fit_param('Rp', 0.9*(1.4 * R_jup), 1.1*(1.4 * R_jup))
pw.fit_info.add_uniform_fit_param('T', 0.5*1200, 1.5*1200)
pw.fit_info.add_uniform_fit_param('Rp', 0.9 * (1.4 * R_jup), 1.1 * (1.4 * R_jup))
pw.fit_info.add_uniform_fit_param('T', 0.5 * 1200, 1.5 * 1200)
pw.fit_info.add_uniform_fit_param("log_scatt_factor", 0, 1)
pw.fit_info.add_uniform_fit_param("logZ", -1, 3)
pw.fit_info.add_uniform_fit_param("log_cloudtop_P", -0.99, 5)
pw.fit_info.add_uniform_fit_param("error_multiple", 0.5, 5)

# Define bins, depths, and errors
pw.wavelengths = 1e-6*np.array([1.119, 1.1387])
pw.bins = [[w-0.0095e-6, w+0.0095e-6] for w in pw.wavelengths]
pw.wavelengths = 1e-6 * np.array([1.119, 1.1387])
pw.bins = [[w - 0.0095e-6, w + 0.0095e-6] for w in pw.wavelengths]
pw.depths = 1e-6 * np.array([14512.7, 14546.5])
pw.errors = 1e-6 * np.array([50.6, 35.5])

Expand Down Expand Up @@ -176,20 +176,20 @@ def example_aws_short(method):

# Fit for the stellar radius and planetary mass using Gaussian priors. This
# is a way to account for the uncertainties in the published values
pw.fit_info.add_gaussian_fit_param('Rs', 0.02*R_sun)
pw.fit_info.add_gaussian_fit_param('Mp', 0.04*M_jup)
pw.fit_info.add_gaussian_fit_param('Rs', 0.02 * R_sun)
pw.fit_info.add_gaussian_fit_param('Mp', 0.04 * M_jup)

# Fit for other parameters using uniform priors
pw.fit_info.add_uniform_fit_param('Rp', 0.9*(1.4 * R_jup), 1.1*(1.4 * R_jup))
pw.fit_info.add_uniform_fit_param('T', 0.5*1200, 1.5*1200)
pw.fit_info.add_uniform_fit_param('Rp', 0.9 * (1.4 * R_jup), 1.1 * (1.4 * R_jup))
pw.fit_info.add_uniform_fit_param('T', 0.5 * 1200, 1.5 * 1200)
pw.fit_info.add_uniform_fit_param("log_scatt_factor", 0, 1)
pw.fit_info.add_uniform_fit_param("logZ", -1, 3)
pw.fit_info.add_uniform_fit_param("log_cloudtop_P", -0.99, 5)
pw.fit_info.add_uniform_fit_param("error_multiple", 0.5, 5)

# Define bins, depths, and errors
pw.wavelengths = 1e-6*np.array([1.119, 1.1387])
pw.bins = [[w-0.0095e-6, w+0.0095e-6] for w in pw.wavelengths]
pw.wavelengths = 1e-6 * np.array([1.119, 1.1387])
pw.bins = [[w - 0.0095e-6, w + 0.0095e-6] for w in pw.wavelengths]
pw.depths = 1e-6 * np.array([14512.7, 14546.5])
pw.errors = 1e-6 * np.array([50.6, 35.5])

Expand Down Expand Up @@ -228,19 +228,19 @@ def example_aws_long(method):
pw.set_parameters(params)

if method == 'multinest':
pw.fit_info.add_gaussian_fit_param('Rs', 0.02*R_sun)
pw.fit_info.add_gaussian_fit_param('Mp', 0.04*M_jup)
pw.fit_info.add_uniform_fit_param('Rp', 0.9*(1.39 * R_jup), 1.1*(1.39 * R_jup))
pw.fit_info.add_gaussian_fit_param('Rs', 0.02 * R_sun)
pw.fit_info.add_gaussian_fit_param('Mp', 0.04 * M_jup)
pw.fit_info.add_uniform_fit_param('Rp', 0.9 * (1.39 * R_jup), 1.1 * (1.39 * R_jup))
pw.fit_info.add_uniform_fit_param('T', 300, 3000)
pw.fit_info.add_uniform_fit_param("log_scatt_factor", 0, 2)
pw.fit_info.add_uniform_fit_param("logZ", -1, 3)
pw.fit_info.add_uniform_fit_param("log_cloudtop_P", -0.99, 7)
pw.fit_info.add_uniform_fit_param("error_multiple", 0.5, 5)
elif method == 'emcee':
pw.fit_info.add_gaussian_fit_param('Rs', 0.02*R_sun)
pw.fit_info.add_gaussian_fit_param('Mp', 0.04*M_jup)
pw.fit_info.add_uniform_fit_param('Rp', 0, np.inf, 0.9*(1.39 * R_jup), 1.1*(1.39 * R_jup))
pw.fit_info.add_uniform_fit_param('T', 300, 3000, 0.5*1476.81, 1.5*1476.81)
pw.fit_info.add_gaussian_fit_param('Rs', 0.02 * R_sun)
pw.fit_info.add_gaussian_fit_param('Mp', 0.04 * M_jup)
pw.fit_info.add_uniform_fit_param('Rp', 0, np.inf, 0.9 * (1.39 * R_jup), 1.1 * (1.39 * R_jup))
pw.fit_info.add_uniform_fit_param('T', 300, 3000, 0.5 * 1476.81, 1.5 * 1476.81)
pw.fit_info.add_uniform_fit_param("log_scatt_factor", 0, 5, 0, 2)
pw.fit_info.add_uniform_fit_param("logZ", -1, 3)
pw.fit_info.add_uniform_fit_param("log_cloudtop_P", -0.99, 7)
Expand Down Expand Up @@ -287,11 +287,11 @@ def get_example_data(object_name):
df = pandas.read_csv(data_file, names=['wavelengths', 'bin_sizes', 'depths', 'errors'])

# Remove and rows outside of wavelength range (3e-7 to 3e-5)
df = df.loc[(1e-6*df['wavelengths'] - 1e-6*df['bin_sizes'] >= 3e-7) & (1e-6*df['wavelengths'] + 1e-6*df['bin_sizes'] <= 3e-5)]
df = df.loc[(1e-6 * df['wavelengths'] - 1e-6 * df['bin_sizes'] >= 3e-7) & (1e-6 * df['wavelengths'] + 1e-6 * df['bin_sizes'] <= 3e-5)]

# Parse the data
wavelengths = 1e-6*np.array(df['wavelengths'])
bin_sizes = 1e-6*np.array(df['bin_sizes'])
wavelengths = 1e-6 * np.array(df['wavelengths'])
bin_sizes = 1e-6 * np.array(df['bin_sizes'])
depths = np.array(df['depths'])
errors = np.array(df['errors'])

Expand Down
68 changes: 34 additions & 34 deletions exoctk/contam_visibility/astro_funcx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,9 @@
epsilon = 23.43929 * D2R # obliquity of the ecliptic J2000


def pa(tgt_c1, tgt_c2, obj_c1, obj_c2):
"""Calculates position angle of object at tgt position.
Parameters
----------
tgt_c1: float
The RA of the target.
tgt_c2: float
The Dec of the target.
obj_c1: float
The RA of the reference.
obj_c2: float
The Dec of the reference.
Returns
-------
float
The position angle.
"""
y = cos(obj_c2) * sin(obj_c1 - tgt_c1)
c = cos(obj_c2) * sin(tgt_c2) * cos(obj_c1 - tgt_c1)
x = sin(obj_c2) * cos(tgt_c2) - c
p = atan2(y, x)
if p < 0.:
p += PI2
if p >= PI2:
p -= PI2
return p


def delta_pa_no_roll(pos1_c1, pos1_c2, pos2_c1, pos2_c2):
"""Calculates the change in position angle between two positions with no
roll about V1
"""Calculates the change in position angle between two positions
with no roll about V1
Parameters
----------
Expand Down Expand Up @@ -96,8 +66,8 @@ def dist(obj1_c1, obj1_c2, obj2_c1, obj2_c2):


def JWST_same_ori(tgt0_c1, tgt0_c2, p0, tgt_c1, tgt_c2):
"""Calculates normal orientation of second target, given first target's
orientation is normal. This is in Ecliptic coordinates!
"""Calculates normal orientation of second target, given first
target's orientation is normal. This is in Ecliptic coordinates!
Parameters
----------
Expand All @@ -124,6 +94,36 @@ def JWST_same_ori(tgt0_c1, tgt0_c2, p0, tgt_c1, tgt_c2):
return pp


def pa(tgt_c1, tgt_c2, obj_c1, obj_c2):
"""Calculates position angle of object at tgt position.
Parameters
----------
tgt_c1: float
The RA of the target.
tgt_c2: float
The Dec of the target.
obj_c1: float
The RA of the reference.
obj_c2: float
The Dec of the reference.
Returns
-------
float
The position angle.
"""
y = cos(obj_c2) * sin(obj_c1 - tgt_c1)
c = cos(obj_c2) * sin(tgt_c2) * cos(obj_c1 - tgt_c1)
x = sin(obj_c2) * cos(tgt_c2) - c
p = atan2(y, x)
if p < 0.:
p += PI2
if p >= PI2:
p -= PI2
return p


def unit_limit(x):
""" Forces value to be in [-1, 1]
Expand Down
Loading

0 comments on commit bb50f59

Please sign in to comment.