Skip to content

Commit

Permalink
feat: separate compute transform + twirl 0.4 (fix #105)
Browse files Browse the repository at this point in the history
feat: separate compute transform + twirl 0.4
  • Loading branch information
lgrcia authored Jun 15, 2023
2 parents 9155fe9 + 10031e2 commit 89ddf93
Show file tree
Hide file tree
Showing 24 changed files with 933 additions and 637 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ _docs
**/.ipynb_checkpoints
docs/tested_blocks.md
docs/md/all_blocks.rst
docs/md/template.py
Binary file modified docs/illustration.afdesign
Binary file not shown.
34 changes: 17 additions & 17 deletions docs/ipynb/casestudies/comet.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/ipynb/casestudies/hiaka.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c0105bfad2da45c3abc9f0b9a5f68ab7",
"model_id": "542764a6dce145e9bec51b0e475d0f08",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -143,9 +143,9 @@
"</div>"
],
"text/plain": [
" date telescope filter type target width \n",
" date telescope filter type target width \\\n",
"id \n",
"1 2022-06-09 Clear light 2002MS4_Artemis_clear_2x2bin 46 \\\n",
"1 2022-06-09 Clear light 2002MS4_Artemis_clear_2x2bin 46 \n",
"2 2022-06-09 bias 2002MS4_Artemis_clear_2x2bin 46 \n",
"\n",
" height exposure files \n",
Expand Down Expand Up @@ -268,7 +268,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4154b1d5ab474741a328a2d59aa19113",
"model_id": "0810254083944a5b8f5bfcaad470e854",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -411,7 +411,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d1ed131076254ab690108f291cc92902",
"model_id": "04353911035c4a9491bf99c2b8134e59",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -511,4 +511,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
84 changes: 45 additions & 39 deletions docs/ipynb/casestudies/transit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"darks = glob(\"/Users/lgrcia/data/WASP12-astrodennis/Darks/*.fit\")\n",
"bias = glob(\"/Users/lgrcia/data/WASP12-astrodennis/Bias/*.fit\")\n",
"flats = glob(\"/Users/lgrcia/data/WASP12-astrodennis/Flats/*.fit\")\n",
"sciences = sorted(glob(\"/Users/lgrcia/data/WASP12-astrodennis/ScienceImages/*.fit\"))"
"sciences = sorted(glob(\"/Users/lgrcia/data/WASP12-astrodennis/ScienceImages/*.fit\"))\n"
]
},
{
Expand All @@ -46,15 +46,15 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e2cbea48128a459690dc145e15d16110",
"model_id": "949f03d414a24bbb887922ab99721442",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -89,10 +89,11 @@
"photometry = Sequence(\n",
" [\n",
" calibration[0], # calibration block (same as above)\n",
" blocks.PointSourceDetection(n=12, minor_length=8), # fewer stars detection\n",
" blocks.Cutouts(21), # stars cutouts\n",
" blocks.MedianEPSF(), # building EPSF\n",
" blocks.Gaussian2D(ref), # modeling EPSF with initial guess\n",
" blocks.PointSourceDetection(n=12, minor_length=8), # fewer stars detection\n",
" blocks.Cutouts(21), # stars cutouts\n",
" blocks.MedianEPSF(), # building EPSF\n",
" blocks.Gaussian2D(ref), # modeling EPSF with initial guess\n",
" blocks.ComputeTransformTwirl(ref), # compute alignment\n",
" blocks.AlignReferenceSources(ref), # alignment\n",
" blocks.CentroidQuadratic(), # centroiding\n",
" blocks.AperturePhotometry(), # aperture photometry\n",
Expand All @@ -101,7 +102,7 @@
" ]\n",
")\n",
"\n",
"photometry.run(sciences)\n"
"photometry.run(sciences)"
]
},
{
Expand All @@ -114,7 +115,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand All @@ -123,29 +124,31 @@
"╒═════════╤════════╤═══════════════════════╤════════════════╕\n",
"│ index │ name │ type │ processing │\n",
"╞═════════╪════════╪═══════════════════════╪════════════════╡\n",
"│ 0 │ │ Calibration │ 1.973 s (4%) │\n",
"│ 0 │ │ Calibration │ 2.315 s (4%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 1 │ │ PointSourceDetection │ 25.323 s (41%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 1 │ │ PointSourceDetection │ 19.750 s (37%) │\n",
"│ 2 │ │ Cutouts │ 2.862 s (5%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 2 │ │ Cutouts │ 2.685 s (5%) │\n",
"│ 3 │ │ MedianEPSF │ 0.226 s (0%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 3 │ │ MedianEPSF0.174 s (0%) │\n",
"│ 4 │ │ Gaussian2D4.024 s (6%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 4 │ │ Gaussian2D │ 3.150 s (6%) │\n",
"│ 5 │ │ ComputeTransformTwirl │ 0.645 s (1%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 5 │ │ AlignReferenceSources │ 5.507 s (10%) │\n",
"│ 6 │ │ AlignReferenceSources │ 0.179 s (0%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 6 │ │ CentroidQuadratic │ 1.436 s (3%) │\n",
"│ 7 │ │ CentroidQuadratic │ 1.844 s (3%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 7 │ │ AperturePhotometry │ 13.381 s (25%) │\n",
"│ 8 │ │ AperturePhotometry │ 17.158 s (28%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 8 │ │ AnnulusBackground │ 6.007 s (11%) │\n",
"│ 9 │ │ AnnulusBackground │ 7.703 s (12%) │\n",
"├─────────┼────────┼───────────────────────┼────────────────┤\n",
"│ 9 │ │ GetFluxes │ 0.026 s (0%) │\n",
"│ 10 │ │ GetFluxes │ 0.032 s (0%) │\n",
"╘═════════╧════════╧═══════════════════════╧════════════════╛"
]
},
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -168,11 +171,11 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"fluxes = photometry[-1].fluxes"
"fluxes = photometry[-1].fluxes\n"
]
},
{
Expand All @@ -185,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -200,7 +203,7 @@
}
],
"source": [
"ref.show()"
"ref.show()\n"
]
},
{
Expand All @@ -213,7 +216,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -237,7 +240,7 @@
"\n",
"# plotting\n",
"ax = plt.subplot(xlabel=\"time (JD)\", ylabel=\"diff. flux\", ylim=(0.94, 1.06))\n",
"diff.plot()"
"diff.plot()\n"
]
},
{
Expand All @@ -250,7 +253,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -292,7 +295,7 @@
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>263.309778</td>\n",
" <td>263.317344</td>\n",
" <td>4.473168</td>\n",
" <td>1.870291</td>\n",
" <td>2.457393e+06</td>\n",
Expand Down Expand Up @@ -364,7 +367,7 @@
" </tr>\n",
" <tr>\n",
" <th>331</th>\n",
" <td>157.131704</td>\n",
" <td>157.139672</td>\n",
" <td>4.015622</td>\n",
" <td>1.013150</td>\n",
" <td>2.457394e+06</td>\n",
Expand All @@ -378,7 +381,7 @@
"text/plain": [
" bkg fwhm airmass time flux\n",
"0 261.908217 4.823861 1.878414 2.457393e+06 1.014314\n",
"1 263.309778 4.473168 1.870291 2.457393e+06 1.003261\n",
"1 263.317344 4.473168 1.870291 2.457393e+06 1.003261\n",
"2 261.167119 4.369253 1.862163 2.457393e+06 1.002052\n",
"3 252.933837 4.677914 1.854302 2.457393e+06 1.012743\n",
"4 252.841623 4.735902 1.846374 2.457393e+06 1.011300\n",
Expand All @@ -387,18 +390,18 @@
"328 157.248958 4.012928 1.013356 2.457394e+06 1.009544\n",
"329 156.650647 4.491135 1.013278 2.457394e+06 1.005749\n",
"330 156.423297 4.576204 1.013210 2.457394e+06 1.007899\n",
"331 157.131704 4.015622 1.013150 2.457394e+06 1.002996\n",
"331 157.139672 4.015622 1.013150 2.457394e+06 1.002996\n",
"\n",
"[332 rows x 5 columns]"
]
},
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"diff.dataframe"
"diff.dataframe\n"
]
},
{
Expand All @@ -413,13 +416,13 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "10714e8006a74b59b3aa779d83b10461",
"model_id": "577a16681be9499da9d9406b449cbc79",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -437,18 +440,21 @@
"faster_photometry = SequenceParallel(\n",
" [\n",
" blocks.Calibration(darks=darks, bias=bias, flats=flats, shared=True),\n",
" blocks.PointSourceDetection(n=12, minor_length=8), # stars detection for alignment\n",
" blocks.PointSourceDetection(\n",
" n=12, minor_length=8\n",
" ), # stars detection for alignment\n",
" blocks.Cutouts(21), # stars cutouts\n",
" blocks.MedianEPSF(), # building EPSF\n",
" blocks.Gaussian2D(ref), # modeling EPSF with initial guess\n",
" blocks.AlignReferenceSources(ref), # alignment\n",
" blocks.ComputeTransformTwirl(ref), # compute alignment\n",
" blocks.AlignReferenceSources(ref), # align sources\n",
" blocks.CentroidQuadratic(), # centroiding\n",
" blocks.AperturePhotometry(), # aperture photometry\n",
" blocks.AnnulusBackground(), # annulus background\n",
" ],\n",
" [\n",
" blocks.GetFluxes(\"fwhm\", \"keyword:AIRMASS\"),\n",
" ]\n",
" ],\n",
")\n",
"\n",
"faster_photometry.run(sciences)"
Expand Down Expand Up @@ -498,4 +504,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
35 changes: 13 additions & 22 deletions docs/ipynb/core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,7 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/lgrcia/code/dev/prose/prose/console_utils.py:15: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from tqdm.autonotebook import tqdm\n"
]
}
],
"outputs": [],
"source": [
"from prose import Image, Block, Sequence\n",
"import numpy as np\n",
Expand Down Expand Up @@ -92,11 +83,18 @@
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 5/5 [00:00<00:00, 8224.13images/s]"
]
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "94a1ad95fe0e4ca5b19395a5cba86e7e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/5 [00:00<?, ?images/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
Expand All @@ -108,13 +106,6 @@
"Hello world (mean: 0.49)\n",
"Hello world (mean: 0.52)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
Expand Down
Loading

0 comments on commit 89ddf93

Please sign in to comment.