|
829 | 829 | "id": "e5d82724-fbd0-47f7-8be0-057d806f09ab", |
830 | 830 | "metadata": {}, |
831 | 831 | "source": [ |
832 | | - "## 5. Analyzing data for our source\n", |
| 832 | + "## 5. Analyzing a single object\n", |
833 | 833 | "\n", |
834 | | - "### 5.1 Matching the source\n", |
835 | | - "\n", |
836 | | - "Recall that we began with an object located at a given RA and DEC and stored it's source ID. We now iterate over the blend models until we find the source with the same **objectId**." |
| 834 | + "Individual objects can be inspected. Here, select the second brightest object in the blend (listed as Source 1 in the output in Section 4.1) and access its objectId." |
837 | 835 | ] |
838 | 836 | }, |
839 | 837 | { |
|
843 | 841 | "metadata": {}, |
844 | 842 | "outputs": [], |
845 | 843 | "source": [ |
846 | | - "for sidx, source in enumerate(blend.sources):\n", |
847 | | - " if source.record_id == sid:\n", |
848 | | - " break\n", |
849 | | - "print(f\"Selected source is at index {sidx}\")" |
| 844 | + "object1 = blend.sources[1]\n", |
| 845 | + "print(object1.record_id)\n" |
850 | 846 | ] |
851 | 847 | }, |
852 | 848 | { |
|
856 | 852 | "source": [ |
857 | 853 | "### 5.2 Creating the flux re-distributed models\n", |
858 | 854 | "\n", |
859 | | - "In the science pipelines measurements are not made on the scarlet models directly. Imperfections in the PSF measurement and deviations of bright galaxies from a simple two-component monotonic morphology solution (see Melchior paper cited above) result in improper measurements. Instead we perform a deblending algorithm based on the SDSS deblender, where we use the scarlet models as templates and re-distribute the flux from the input image based on the ratio of values for overlapping templates in an image." |
| 855 | + "In the LSST science pipelines, measurements are not made on the scarlet models directly. Imperfections in the PSF measurement and deviations of bright galaxies from a simple two-component monotonic morphology solution (see Melchior paper cited above) result in improper measurements. THIS STATEMENT TBD: Instead, a deblending algorithm based on the SDSS deblender is employed, using the scarlet models as templates, and flux is re-distributed from the input image based on the ratio of values for overlapping templates in an image." |
860 | 856 | ] |
861 | 857 | }, |
862 | 858 | { |
|
876 | 872 | "source": [ |
877 | 873 | "### 5.3 Display the source model\n", |
878 | 874 | "\n", |
879 | | - "We now view the three different models for the source:\n", |
880 | | - "- The deconvolved scarlet model\n", |
881 | | - "- The convolution of the scarlet model with the difference kernel\n", |
882 | | - "- The flux-redistributed model that the science pipelines use for measurement" |
| 875 | + "Three different models for the object are available for inspection. 1) The deconvolved scarlet model; 2) the convolution of the scarlet model with the difference kernel; and 3) the flux-redistributed model that the science pipelines use for measurement. The section demonstrates how to plot these three different models for source 1 in the blend.\n", |
| 876 | + "\n", |
| 877 | + "First, extract the deconvolved model from the object. The output is a Scarlet Lite image." |
| 878 | + ] |
| 879 | + }, |
| 880 | + { |
| 881 | + "cell_type": "code", |
| 882 | + "execution_count": null, |
| 883 | + "id": "da188ade-30ce-4f85-a55a-e001dabb67e9", |
| 884 | + "metadata": {}, |
| 885 | + "outputs": [], |
| 886 | + "source": [ |
| 887 | + "source_model = object1.get_model()" |
| 888 | + ] |
| 889 | + }, |
| 890 | + { |
| 891 | + "cell_type": "markdown", |
| 892 | + "id": "04ecbf7d-6039-49e2-ad8c-848f911d4817", |
| 893 | + "metadata": {}, |
| 894 | + "source": [ |
| 895 | + "Next, project the model into a box large enough to fit the convolved model." |
| 896 | + ] |
| 897 | + }, |
| 898 | + { |
| 899 | + "cell_type": "code", |
| 900 | + "execution_count": null, |
| 901 | + "id": "e0be3f3d-c6f8-4238-8e19-0a0b16aebf74", |
| 902 | + "metadata": {}, |
| 903 | + "outputs": [], |
| 904 | + "source": [ |
| 905 | + "psf_radius = int((np.max(blend.observation.psfs.shape)+1)//2)\n", |
| 906 | + "enlarged_box = source_model.bbox.grow(psf_radius)\n", |
| 907 | + "convolved_model = source_model.copy().project(bbox=enlarged_box)" |
| 908 | + ] |
| 909 | + }, |
| 910 | + { |
| 911 | + "cell_type": "markdown", |
| 912 | + "id": "747da137-5b5d-499d-b828-4e102b81c6ac", |
| 913 | + "metadata": {}, |
| 914 | + "source": [ |
| 915 | + "Finally, plot the three models for the object for inspection." |
883 | 916 | ] |
884 | 917 | }, |
885 | 918 | { |
|
889 | 922 | "metadata": {}, |
890 | 923 | "outputs": [], |
891 | 924 | "source": [ |
892 | | - "# Extract the deconvovled model from the source (a scarlet lite Image)\n", |
893 | | - "source_model = source.get_model()\n", |
894 | | - "\n", |
895 | 925 | "fig, ax = plt.subplots(1, 3, figsize=(15, 5))\n", |
896 | 926 | "\n", |
897 | 927 | "# Display the deconvolved model\n", |
898 | | - "extent = scl.display.get_extent(source.bbox)\n", |
899 | | - "rgb = scl.display.img_to_rgb(source_model[display_bands], norm=norm)\n", |
| 928 | + "extent = sl.display.get_extent(object1.bbox)\n", |
| 929 | + "rgb = sl.display.img_to_rgb(source_model[display_bands], norm=norm)\n", |
900 | 930 | "ax[0].imshow(rgb, origin='lower', extent=extent)\n", |
901 | 931 | "ax[0].set_title(\"Deconvolved Model\")\n", |
902 | 932 | "\n", |
903 | | - "# Project the model into a box large enough to fit the convolved model\n", |
904 | | - "psf_radius = int((np.max(blend.observation.psfs.shape)+1)//2)\n", |
905 | | - "enlarged_box = source_model.bbox.grow(psf_radius)\n", |
906 | | - "convolved_model = source_model.copy().project(bbox=enlarged_box)\n", |
907 | | - "\n", |
908 | 933 | "# Convolve the model with the difference kernel\n", |
909 | 934 | "convolved_model = blend.observation.convolve(convolved_model)\n", |
910 | | - "extent = scl.display.get_extent(enlarged_box)\n", |
911 | | - "rgb = scl.display.img_to_rgb(convolved_model[display_bands], norm=norm)\n", |
| 935 | + "extent = sl.display.get_extent(enlarged_box)\n", |
| 936 | + "rgb = sl.display.img_to_rgb(convolved_model[display_bands], norm=norm)\n", |
912 | 937 | "ax[1].imshow(rgb, origin='lower', extent=extent)\n", |
913 | 938 | "ax[1].set_title(\"Convolved Model\")\n", |
914 | 939 | "\n", |
915 | 940 | "# Display the flux-weighted image\n", |
916 | | - "flux_model = source.flux_weighted_image\n", |
917 | | - "extent = scl.display.get_extent(flux_model.bbox)\n", |
918 | | - "rgb = scl.display.img_to_rgb(flux_model[display_bands], norm=norm)\n", |
| 941 | + "flux_model = object1.flux_weighted_image\n", |
| 942 | + "extent = sl.display.get_extent(flux_model.bbox)\n", |
| 943 | + "rgb = sl.display.img_to_rgb(flux_model[display_bands], norm=norm)\n", |
919 | 944 | "ax[2].imshow(rgb, origin='lower', extent=extent)\n", |
920 | 945 | "ax[2].set_title(\"Flux Re-distributed Model\")\n", |
921 | 946 | "\n", |
|
0 commit comments