|
206 | 206 | { |
207 | 207 | "cell_type": "markdown", |
208 | 208 | "id": "d1b736d4-03d4-4fe2-9d47-a086b75cb25e", |
209 | | - "metadata": { |
210 | | - "execution": { |
211 | | - "iopub.execute_input": "2025-07-12T20:54:42.295267Z", |
212 | | - "iopub.status.busy": "2025-07-12T20:54:42.294407Z", |
213 | | - "iopub.status.idle": "2025-07-12T20:54:42.300822Z", |
214 | | - "shell.execute_reply": "2025-07-12T20:54:42.300205Z", |
215 | | - "shell.execute_reply.started": "2025-07-12T20:54:42.295227Z" |
216 | | - } |
217 | | - }, |
| 209 | + "metadata": {}, |
218 | 210 | "source": [ |
219 | 211 | "Option to view the table." |
220 | 212 | ] |
|
285 | 277 | "\n", |
286 | 278 | "Upload the table to the TAP service and join it with the `DiaObject` table.\n", |
287 | 279 | "\n", |
288 | | - "Use a spatial cross-match radius of 0.5 arcsec (0.00014 deg), and impose the constraint that only matched `DiaObjects` that were detected more than 10 times are returned." |
| 280 | + "Use a spatial cross-match radius of 0.5 arcsec (0.00014 deg), and impose the constraint that only matched `DiaObjects` that were detected more than 10 times are returned (`nDiaSources` > 10).\n", |
| 281 | + "\n", |
| 282 | + "Also return the `DISTANCE()`, the radial distance in degrees, between the target and the `DiaObject`.\n", |
| 283 | + "In this scenario, all matches to the `DiaObject` table are exact matches to known `DiaObjects`, so\n", |
| 284 | + "all distances will be 0.0, but in other scenarios it would be informative." |
289 | 285 | ] |
290 | 286 | }, |
291 | 287 | { |
|
333 | 329 | "dia_objects = job.fetch_result().to_table()" |
334 | 330 | ] |
335 | 331 | }, |
| 332 | + { |
| 333 | + "cell_type": "markdown", |
| 334 | + "id": "ea8c6ee8-582c-4d76-ab35-94dc8aaaa1c5", |
| 335 | + "metadata": {}, |
| 336 | + "source": [ |
| 337 | + "Show the table of the 13 matched `DiaObjects`." |
| 338 | + ] |
| 339 | + }, |
336 | 340 | { |
337 | 341 | "cell_type": "code", |
338 | 342 | "execution_count": null, |
|
463 | 467 | }, |
464 | 468 | { |
465 | 469 | "cell_type": "markdown", |
466 | | - "id": "5de2d0b7-df38-4fcc-9f40-30dfd13b0b20", |
| 470 | + "id": "f14e55e2-b4ed-4642-8d98-0f63dda10be3", |
467 | 471 | "metadata": {}, |
468 | 472 | "source": [ |
469 | | - "### 3.3. Plot light curves\n", |
470 | | - "\n", |
471 | | - "Show the first six light curves." |
472 | | - ] |
473 | | - }, |
474 | | - { |
475 | | - "cell_type": "code", |
476 | | - "execution_count": null, |
477 | | - "id": "d30ff9ff-44d9-414c-865c-cd2c04ec29fd", |
478 | | - "metadata": {}, |
479 | | - "outputs": [], |
480 | | - "source": [ |
481 | | - "fig, ax = plt.subplots(3, 2, figsize=(8, 6), sharey=False, sharex=False)\n", |
482 | | - "x = 0\n", |
483 | | - "for i in range(3):\n", |
484 | | - " for j in range(2):\n", |
485 | | - " for f, filt in enumerate(filter_names):\n", |
486 | | - " dx = np.where(fsodo_table['diaObjectId'] == dia_objects['diaObjectId'][x])\n", |
487 | | - " lc = fsodo_table[dx]\n", |
488 | | - " fx = np.where(lc['band'] == filt)[0]\n", |
489 | | - " ax[i, j].plot(lc['expMidptMJD'][fx], lc['psfDiffFlux'][fx],\n", |
490 | | - " filter_symbols[filt], ms=5, mew=0, alpha=0.5,\n", |
491 | | - " color=filter_colors[filt])\n", |
492 | | - " del dx, fx\n", |
493 | | - " ax[i, j].set_title(dia_objects['diaObjectId'][x])\n", |
494 | | - " del lc\n", |
495 | | - " if i == 2:\n", |
496 | | - " ax[i, j].xaxis.set_label_text('MJD (days)')\n", |
497 | | - " if j == 0:\n", |
498 | | - " ax[i, j].yaxis.set_label_text('Diff Flux (nJy)')\n", |
499 | | - " x += 1\n", |
500 | | - "plt.tight_layout()\n", |
501 | | - "plt.show()" |
502 | | - ] |
503 | | - }, |
504 | | - { |
505 | | - "cell_type": "markdown", |
506 | | - "id": "4e7a87a5-591e-40bd-bc84-6b4684086c22", |
507 | | - "metadata": { |
508 | | - "execution": { |
509 | | - "iopub.execute_input": "2025-07-11T23:08:26.897157Z", |
510 | | - "iopub.status.busy": "2025-07-11T23:08:26.896523Z", |
511 | | - "iopub.status.idle": "2025-07-11T23:08:26.900745Z", |
512 | | - "shell.execute_reply": "2025-07-11T23:08:26.900226Z", |
513 | | - "shell.execute_reply.started": "2025-07-11T23:08:26.897137Z" |
514 | | - } |
515 | | - }, |
516 | | - "source": [ |
517 | | - "> **Figure 2**: The first six light curves." |
| 473 | + "See Section 5 for a demonstration of how to plot light curves using the retrieved forced photometry." |
518 | 474 | ] |
519 | 475 | }, |
520 | 476 | { |
|
532 | 488 | "id": "e1a38fc2-7157-44be-a46e-65a7d7034959", |
533 | 489 | "metadata": {}, |
534 | 490 | "source": [ |
535 | | - "## 4. Query in one step with table join\n", |
| 491 | + "## 4. Query in one step (table join)\n", |
536 | 492 | "\n", |
537 | 493 | "Combine the two steps of Section 3 into a single query with table joins.\n", |
538 | 494 | "\n", |
|
609 | 565 | "The `fsodo_table_2` table contains the same data as the `fsodo_table` from Section 3.2." |
610 | 566 | ] |
611 | 567 | }, |
| 568 | + { |
| 569 | + "cell_type": "markdown", |
| 570 | + "id": "754d3933-7f37-4760-be40-5d7d87d85380", |
| 571 | + "metadata": {}, |
| 572 | + "source": [ |
| 573 | + "## 5. Plot light curves\n", |
| 574 | + "\n", |
| 575 | + "How to plot light curves is also demonstrated in other tutorials.\n", |
| 576 | + "\n", |
| 577 | + "First get the identifiers of the unique `DiaObjects` for which forced photometry was returned." |
| 578 | + ] |
| 579 | + }, |
| 580 | + { |
| 581 | + "cell_type": "code", |
| 582 | + "execution_count": null, |
| 583 | + "id": "7a7abda0-06e9-4a8d-9a1c-304e5836496e", |
| 584 | + "metadata": {}, |
| 585 | + "outputs": [], |
| 586 | + "source": [ |
| 587 | + "unique_dia_obj_id = np.unique(fsodo_table_2['diaObjectId'])\n", |
| 588 | + "assert len(unique_dia_obj_id) == 13\n", |
| 589 | + "print(len(unique_dia_obj_id))" |
| 590 | + ] |
| 591 | + }, |
| 592 | + { |
| 593 | + "cell_type": "code", |
| 594 | + "execution_count": null, |
| 595 | + "id": "ece45d82-9c46-4933-8017-7943fbda2f61", |
| 596 | + "metadata": {}, |
| 597 | + "outputs": [], |
| 598 | + "source": [ |
| 599 | + "fig, ax = plt.subplots(3, 2, figsize=(8, 6), sharey=False, sharex=False)\n", |
| 600 | + "x = 0\n", |
| 601 | + "for i in range(3):\n", |
| 602 | + " for j in range(2):\n", |
| 603 | + " for f, filt in enumerate(filter_names):\n", |
| 604 | + " dx = np.where(fsodo_table_2['diaObjectId'] == unique_dia_obj_id[x])\n", |
| 605 | + " lc = fsodo_table_2[dx]\n", |
| 606 | + " fx = np.where(lc['band'] == filt)[0]\n", |
| 607 | + " ax[i, j].plot(lc['expMidptMJD'][fx], lc['psfDiffFlux'][fx],\n", |
| 608 | + " filter_symbols[filt], ms=5, mew=0, alpha=0.5,\n", |
| 609 | + " color=filter_colors[filt])\n", |
| 610 | + " del dx, fx\n", |
| 611 | + " ax[i, j].set_title(unique_dia_obj_id[x])\n", |
| 612 | + " del lc\n", |
| 613 | + " if i == 2:\n", |
| 614 | + " ax[i, j].xaxis.set_label_text('MJD (days)')\n", |
| 615 | + " if j == 0:\n", |
| 616 | + " ax[i, j].yaxis.set_label_text('Diff Flux (nJy)')\n", |
| 617 | + " x += 1\n", |
| 618 | + "plt.tight_layout()\n", |
| 619 | + "plt.show()" |
| 620 | + ] |
| 621 | + }, |
| 622 | + { |
| 623 | + "cell_type": "markdown", |
| 624 | + "id": "13980e34-720d-45f6-8203-aafd3cc81f9f", |
| 625 | + "metadata": {}, |
| 626 | + "source": [ |
| 627 | + "> **Figure 2**: The first six light curves." |
| 628 | + ] |
| 629 | + }, |
612 | 630 | { |
613 | 631 | "cell_type": "code", |
614 | 632 | "execution_count": null, |
615 | | - "id": "a4409ee3-913a-4b26-b011-7f2377505def", |
| 633 | + "id": "554754c2-4520-4b2f-bacb-a7abf485eec2", |
616 | 634 | "metadata": {}, |
617 | 635 | "outputs": [], |
618 | 636 | "source": [ |
|
622 | 640 | { |
623 | 641 | "cell_type": "code", |
624 | 642 | "execution_count": null, |
625 | | - "id": "248dcf99-df74-4f63-9cd2-ef30ad01adc7", |
| 643 | + "id": "554ccd20-3008-46e7-94b9-583412eef179", |
626 | 644 | "metadata": {}, |
627 | 645 | "outputs": [], |
628 | 646 | "source": [] |
|
0 commit comments