Skip to content

Commit

Permalink
Hopefully no longer passing NaN pixels into libraries that don't like…
Browse files Browse the repository at this point in the history
… such things.
  • Loading branch information
polemarkh committed Jul 11, 2019
1 parent 88ba9b3 commit 6b30b0b
Show file tree
Hide file tree
Showing 9 changed files with 428 additions and 535 deletions.
3 changes: 2 additions & 1 deletion jwst_pancake/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ def calculate_subtracted(raw_config, target=None, reference=None, ta_error=False
for r in sgd_results:
slope = r['2d']['detector']
sgd_slopes.append(slope)
reg = register_to_target(slope, target_slope, rescale_reference=True)
mask = np.where(np.isnan(slope), 1., 0.)
reg = register_to_target(slope, target_slope, mask=mask, rescale_reference=True)
sgd_reg.append(reg)

sgd_reg = np.array(sgd_reg)
Expand Down
344 changes: 44 additions & 300 deletions notebooks/covariance_contrast.ipynb

Large diffs are not rendered by default.

197 changes: 27 additions & 170 deletions notebooks/miri_pandeia_pancake.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion notebooks/miri_photon_noise_and_contrast.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
15 changes: 9 additions & 6 deletions notebooks/miri_small_grid_dither.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
"from pandeia.engine.perform_calculation import perform_calculation\n",
"\n",
"from copy import deepcopy\n",
"import numpy as np"
"import numpy as np\n",
"\n",
"import time"
]
},
{
Expand Down Expand Up @@ -184,13 +186,14 @@
"options.on_the_fly_PSFs = True\n",
"otf_options = options.current_options\n",
"\n",
"print(\"Calculating Target\")\n",
"print(\"Calculating Target at {}\".format(time.ctime()))\n",
"otf_targ_results = pancake.engine.calculate_target(config)\n",
"otf_sgd_results = []\n",
"for i, s in enumerate(sgd_configs):\n",
" print(\"Calculating SGD {} of {}\".format(i+1, len(sgd_configs)))\n",
" print(\"Calculating SGD {} of {} at {}\".format(i+1, len(sgd_configs), time.ctime()))\n",
" otf_sgd_results.append(pancake.engine.calculate_reference(s))\n",
"\n",
"print(\"Done SGD\")\n",
"options.current_options = initial_options"
]
},
Expand Down Expand Up @@ -280,9 +283,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python (pancake p13 w08)",
"display_name": "Python (pancake)",
"language": "python",
"name": "pancake_p13_w08"
"name": "pancake"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -294,7 +297,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
13 changes: 3 additions & 10 deletions notebooks/nircam_pandeia_pancake.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -419,20 +419,13 @@
"source": [
"In this case, the above figures show that pancake's ```calculate_subtracted``` convenience function manages to compensate for the PSF changes with target offset, whereas pandeia does not perform quite as well."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (pancake p13 w08)",
"display_name": "Python (pancake)",
"language": "python",
"name": "pancake_p13_w08"
"name": "pancake"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -444,7 +437,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
263 changes: 227 additions & 36 deletions notebooks/nircam_photon_noise_and_contrast.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions notebooks/nircam_small_grid_dither.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:test_pancake]",
"display_name": "Python (pancake)",
"language": "python",
"name": "conda-env-test_pancake-py"
"name": "pancake"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -298,7 +298,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
120 changes: 112 additions & 8 deletions notebooks/stsci_pancake_installation.ipynb

Large diffs are not rendered by default.

0 comments on commit 6b30b0b

Please sign in to comment.