Skip to content

Commit

Permalink
Merge pull request #41 from JarronL/develop
Browse files Browse the repository at this point in the history
notebooks and tqdm in nb_func.py
  • Loading branch information
JarronL committed Nov 18, 2020
2 parents 3d367cc + 2e94785 commit 372540f
Show file tree
Hide file tree
Showing 20 changed files with 2,230 additions and 54 deletions.
2 changes: 1 addition & 1 deletion dev_utils/NIRCam_Darks/NIRCam_darks_485.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.7.9"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion dev_utils/NIRCam_Darks/NIRCam_darks_485_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand Down
705 changes: 705 additions & 0 deletions dev_utils/NIRCam_Flats/NIRCam_flats_485.ipynb

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions dev_utils/WFE_coefficients.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notebook to develop the methods and algorithms that will produce the necessary modifications to PSF coefficients in order to handle changes in the WFE, either through OTE thermal/frill/IEC drifts, or field-dependent SI WFE "
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down Expand Up @@ -1619,7 +1626,7 @@
"cell_type": "code",
"execution_count": 245,
"metadata": {
"collapsed": true
"scrolled": false
},
"outputs": [
{
Expand Down Expand Up @@ -29196,7 +29203,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.9"
},
"mimetype": "text/x-python",
"name": "python",
Expand Down
2 changes: 1 addition & 1 deletion dev_utils/WFE_interp_NIRCam.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
"version": "3.7.9"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion dev_utils/WebbPSF_OTE_LM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.7.9"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion dev_utils/off_axis_psf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2446,7 +2446,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.9"
}
},
"nbformat": 4,
Expand Down
288 changes: 288 additions & 0 deletions notebooks/Exoplanet_Filter_Selection.ipynb

Large diffs are not rendered by default.

888 changes: 888 additions & 0 deletions notebooks/GO/NRC_GO_YSO_RXJ1615.ipynb

Large diffs are not rendered by default.

Binary file added notebooks/GO/YSOs/RXJ1615_SED.pdf
Binary file not shown.
Binary file added notebooks/GO/YSOs/RXJ1615_contrast.pdf
Binary file not shown.
Binary file added notebooks/GO/YSOs/RXJ1615_images.pdf
Binary file not shown.
277 changes: 277 additions & 0 deletions notebooks/GO/votables/RXJ1615.vot

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion notebooks/GTO/NRC_GTO_MDwarf_LW_Compare.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2345,7 +2345,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
"version": "3.7.9"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion notebooks/GTO/NRC_GTO_MDwarf_LW_M430R.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3310,7 +3310,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
"version": "3.7.9"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions notebooks/GTO/NRC_GTO_Transits.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -117,15 +117,15 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 1.73 s, sys: 763 ms, total: 2.49 s\n",
"Wall time: 2.5 s\n"
"CPU times: user 18.9 s, sys: 11.3 s, total: 30.3 s\n",
"Wall time: 30.9 s\n"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion notebooks/GTO/NRC_GTO_YSO_MWC758.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
"version": "3.7.9"
}
},
"nbformat": 4,
Expand Down
53 changes: 27 additions & 26 deletions notebooks/GTO/NRC_GTO_YSO_PDS70.ipynb

Large diffs are not rendered by default.

Binary file modified notebooks/GTO/YSOs/PDS70_SED.pdf
Binary file not shown.
38 changes: 24 additions & 14 deletions pynrc/nb_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from .obs_nircam import model_to_hdulist, obs_hci
#from .obs_nircam import plot_contrasts, plot_contrasts_mjup, planet_mags, plot_planet_patches

from tqdm.auto import tqdm, trange

import logging
_log = logging.getLogger('nb_funcs')

Expand Down Expand Up @@ -373,7 +375,7 @@ def do_contrast(obs_dict, wfe_list, filt_keys, nsig=5, roll_angle=10, verbose=Fa
return contrast_all


def do_gen_hdus(obs_dict, filt_keys, wfe_ref_drift, wfe_roll_drift, verbose=True, **kwargs):
def do_gen_hdus(obs_dict, filt_keys, wfe_ref_drift, wfe_roll_drift, verbose=False, **kwargs):

"""
kwargs to pass to gen_roll_image() and their defaults:
Expand All @@ -392,7 +394,7 @@ def do_gen_hdus(obs_dict, filt_keys, wfe_ref_drift, wfe_roll_drift, verbose=True
"""

hdulist_dict = {}
for key in filt_keys:
for key in tqdm(filt_keys):
if verbose: print(key)
obs = obs_dict[key]
obs.wfe_ref_drift = wfe_ref_drift
Expand Down Expand Up @@ -1164,7 +1166,7 @@ def do_plot_contrasts(curves_ref, curves_roll, nsig, wfe_list, obs, age, age2=No
def do_plot_contrasts2(key1, key2, curves_all, nsig, obs_dict, wfe_list, age, sat_dict=None,
label1='Curves1', label2='Curves2', xr=[0,10], yr=[24,8],
yscale2='log', yr2=None, av_vals=[0,10], curves_all2=None,
c1=None, c2=None, linder_models=True, **kwargs):
c1=None, c2=None, linder_models=True, planet_patches=True, **kwargs):

fig, axes = plt.subplots(1,2, figsize=(14,5))

Expand Down Expand Up @@ -1194,10 +1196,10 @@ def do_plot_contrasts2(key1, key2, curves_all, nsig, obs_dict, wfe_list, age, sa
ax=ax, xr=xr, yr=yr, colors=c2)

# Planet mass locations
plot_planet_patches(ax, obs_dict[key1], age=age, update_title=True, av_vals=av_vals,
linder=linder_models, **kwargs)


if planet_patches:
plot_planet_patches(ax, obs_dict[key1], age=age, update_title=True, av_vals=av_vals,
linder=linder_models, **kwargs)
ax.set_title('Flux Sensitivities')

# Right plot (Converted to MJup/MEarth)
ax = axes[1]
Expand Down Expand Up @@ -1236,14 +1238,22 @@ def do_plot_contrasts2(key1, key2, curves_all, nsig, obs_dict, wfe_list, age, sa
h3 = handles[2*nwfe:]
h1_t = [mpatches.Patch(color='none', label=label1)]
h2_t = [mpatches.Patch(color='none', label=label2)]
h3_t = [mpatches.Patch(color='none', label='Models')]
if key2 is not None:
handles_new = h1_t + h1 + h2_t + h2 + h3_t + h3
ncol = 3
h3_t = [mpatches.Patch(color='none', label='{} ({})'.format(mod_str, obs_dict[key1].filter))]
if planet_patches:
if key2 is not None:
handles_new = h1_t + h1 + h2_t + h2 + h3_t + h3
ncol = 3
else:
h3 = handles[nwfe:]
handles_new = h1_t + h1 + h3_t + h3
ncol = 2
else:
h3 = handles[nwfe:]
handles_new = h1_t + h1 + h3_t + h3
ncol = 2
if key2 is not None:
handles_new = h1_t + h1 + h2_t + h2
ncol = 2
else:
handles_new = h1_t + h1
ncol = 1
ax.legend(ncol=ncol, handles=handles_new, loc=1, fontsize=9)

# Right legend
Expand Down

0 comments on commit 372540f

Please sign in to comment.