Experiments with GalSim, Part 2

This Julia notebook uses several files generated by running the galsim.ipynb Python notebook. So run this one after running that one.


In [1]:
Pkg.status("Celeste")


 - Celeste                       0.4.0+             jcr/galsim (dirty)

In [2]:
import Celeste: AccuracyBenchmark, ParallelRun, GalsimBenchmark, Config, Model
using DataFrames
import PyPlot

Running Celeste.jl on the same data as SExtractor


In [3]:
extensions = AccuracyBenchmark.read_fits("three_sources_two_overlap.fits");

In [4]:
data = extensions[2].pixels'
m, s = mean(data), std(data)
PyPlot.imshow(data, interpolation="nearest", cmap="gray", vmin=m-s, vmax=m+s, origin="lower");



In [5]:
header = extensions[1].header
this_test_case_name = header["CLDESCR"]
num_sources = header["CLNSRC"]
images = AccuracyBenchmark.make_images(extensions)
truth_catalog_df = GalsimBenchmark.extract_catalog_from_header(header)
catalog_entries = AccuracyBenchmark.make_initialization_catalog(truth_catalog_df, false)
target_sources = collect(1:num_sources)
config = Config(min_radius_pix = 40.0)
patches = Model.get_sky_patches(images, catalog_entries)
neighbor_map = Dict(i=>Model.find_neighbors(patches, i) for i in target_sources);

In [6]:
results = ParallelRun.one_node_joint_infer(catalog_entries,
                                           patches,
                                           target_sources,
                                           neighbor_map,
                                           images,
                                           config=config)
prediction_df = AccuracyBenchmark.celeste_to_df(results)


[1]<1> INFO: Optimizing 3 sources
[1]<1> INFO: Done assigning sources to threads for processing
[1]<1> INFO: Processing with dynamic connected components load balancing
[1]<1> INFO: Batch 1 - [60.0131]
[1]<1> INFO: Batch 1 avg threads idle: 0% (0.0 / 60.013057423)
[1]<1> INFO: Batch 1 - [10.8018]
[1]<1> INFO: Batch 1 avg threads idle: 0% (0.0 / 10.801802773)
[1]<1> INFO: Batch 1 - [10.1923]
[1]<1> INFO: Batch 1 avg threads idle: 0% (0.0 / 10.192287)
[1]<1> INFO: Total idle time: 0, Total sum of threads times: 81
[1]<1> INFO: 16:47:32.836: (active,inactive) pixels processed: (1378555,891670)
Out[6]:
radecis_stargal_frac_devgal_axis_ratiogal_radius_pxgal_angle_degflux_r_nmgycolor_ugcolor_grcolor_ricolor_izlog_flux_r_stderrcolor_ug_stderrcolor_gr_stderrcolor_ri_stderrcolor_iz_stderr
10.003933840.006713890.9948530.02896620.07829540.1235178.704649.950851.377290.6442760.2731790.1257950.01000950.04432760.01547910.01002410.0102635
20.005845560.006713890.005000240.01027640.2299813.7874536.54079.874450.2651360.6749060.3468160.249660.01000440.02560830.01626180.01000840.0100292
30.008115270.002547220.9920620.6711550.1657490.204615148.01210.121.406460.6375840.2633930.1577180.01000740.04427360.01522050.01001620.0100638

Comparision to Hyper Suprime-Cam (HSC) software pipeline

"The single biggest failure mode of the deblender occurs when three or more peaks in a blend appear in a straight line"


In [7]:
extensions = AccuracyBenchmark.read_fits("three_sources_in_a_row.fits");
data = extensions[2].pixels'
m, s = mean(data), std(data)
PyPlot.imshow(data, interpolation="nearest", cmap="gray", vmin=m-s, vmax=m+s, origin="lower");



In [8]:
header = extensions[1].header
this_test_case_name = header["CLDESCR"]
num_sources = header["CLNSRC"]
images = AccuracyBenchmark.make_images(extensions)
truth_catalog_df = GalsimBenchmark.extract_catalog_from_header(header)
catalog_entries = AccuracyBenchmark.make_initialization_catalog(truth_catalog_df, false)
target_sources = collect(1:num_sources)
config = Config(min_radius_pix = 40.0)
patches = Model.get_sky_patches(images, catalog_entries)
neighbor_map = Dict(i=>Model.find_neighbors(patches, i) for i in target_sources);

In [9]:
results = ParallelRun.one_node_joint_infer(catalog_entries,
                                           patches,
                                           target_sources,
                                           neighbor_map,
                                           images,
                                           config=config)
prediction_df = AccuracyBenchmark.celeste_to_df(results)


[1]<1> INFO: Optimizing 3 sources
[1]<1> INFO: Done assigning sources to threads for processing
[1]<1> INFO: Processing with dynamic connected components load balancing
[1]<1> INFO: Batch 1 - [38.2697]
[1]<1> INFO: Batch 1 avg threads idle: 0% (0.0 / 38.269722026)
[1]<1> INFO: Batch 1 - [11.1801]
[1]<1> INFO: Batch 1 avg threads idle: 0% (0.0 / 11.180149435)
[1]<1> INFO: Batch 1 - [12.1704]
[1]<1> INFO: Batch 1 avg threads idle: 0% (0.0 / 12.170381386)
[1]<1> INFO: Total idle time: 0, Total sum of threads times: 62
[1]<1> INFO: 16:48:35.687: (active,inactive) pixels processed: (1471605,825345)
Out[9]:
radecis_stargal_frac_devgal_axis_ratiogal_radius_pxgal_angle_degflux_r_nmgycolor_ugcolor_grcolor_ricolor_izlog_flux_r_stderrcolor_ug_stderrcolor_gr_stderrcolor_ri_stderrcolor_iz_stderr
10.002269150.004408310.005000390.01002940.4169983.5839944.28729.976710.2202250.6897560.3340130.2238150.01000390.02359270.01527790.01000820.0100374
20.005012220.005241660.005000760.0100190.4553423.60303177.9862.909410.1172450.745130.3914450.1909260.01291610.06027430.0402760.01470860.0195123
30.008658080.006324990.9914950.8731050.03861130.100173169.0083.013051.393070.6609040.2598270.1630770.0115770.1019360.03130390.01314230.0175898