项目作者: LSSTDESC

项目描述 :
Tools to create blend catalogs, produce training samples and implement blending metrics
高级语言: Jupyter Notebook
项目地址: git://github.com/LSSTDESC/BlendingToolKit.git
创建时间: 2018-07-27T15:22:14Z
项目社区:https://github.com/LSSTDESC/BlendingToolKit

开源协议:MIT License

下载


BlendingToolKit

tests
notebooks
docs
codecov
pre-commit
[PyPI][pypi]

[pypi]: https://pypi.org/project/blending-toolkit

Summary

Framework for fast generation and analysis of galaxy blends catalogs. This toolkit is a convenient way of
producing multi-band postage stamp images of blend scenes and evaluate the performance of deblending algorithms.

Documentation can be found at https://lsstdesc.org/BlendingToolKit/index.html.

Workflow

btk workflow

In red are components of the BTK pipeline that are intended to be easily customized by users to meet their
science needs.

Code example

In what follows we illustrate how to use BTK to generate blended images, run a deblender on them, and
evaluate the performance of the deblender using metrics. For more details on this example see our
quick-start notebook at notebooks/00-quickstart.ipynb.

  1. import btk
  2. # setup CATSIM catalog
  3. catalog_name = "../data/input_catalog.fits"
  4. catalog = btk.catalog.CatsimCatalog.from_file(catalog_name)
  5. # setup survey parameters
  6. survey = btk.survey.get_surveys("LSST")
  7. # setup sampling function
  8. # this function determines how to organize galaxies in catalog into blends
  9. stamp_size = 24.0
  10. sampling_function = btk.sampling_functions.DefaultSampling(
  11. catalog=catalog, max_number=5, max_mag=25.3, stamp_size=stamp_size
  12. )
  13. # setup generator to create batches of blends
  14. batch_size = 100
  15. draw_generator = btk.draw_blends.CatsimGenerator(
  16. catalog, sampling_function, survey, batch_size
  17. )
  18. # get batch of blends
  19. blend_batch = next(draw_generator)
  20. # setup deblender (we use SEP in this case)
  21. deblender = btk.deblend.SepSingleBand(max_n_sources=5,
  22. use_band=2 # measure on 'r' band
  23. )
  24. # run deblender on generated blend images (all batches)
  25. deblend_batch = deblender(blend_batch)
  26. # setup matcher
  27. matcher = btk.match.PixelHungarianMatcher(pixel_max_sep=5.0 # maximum separation in pixels for matching
  28. )
  29. # match true and predicted catalogs
  30. truth_catalogs = blend_batch.catalog_list
  31. pred_catalogs = deblend_batch.catalog_list
  32. matching = matcher(truth_catalogs, pred_catalogs) # object with matching information
  33. # compute detection performance on this batch
  34. recall = btk.metrics.detection.Recall(batch_size)
  35. precision = btk.metrics.detection.Precision(batch_size)
  36. print("Recall: ", recall(matching.tp, matching.t, matching.p))
  37. print("Precision: ", precision(matching.tp, matching.t, matching.p))

Installation

BTK is pip installable, with the following command:

  1. pip install blending-toolkit

In case of any issues and for details of required packages, please see the more detailed installation instructions here.

Contributing

Everyone can contribute to this project, please refer to the CONTRIBUTING.md document for details.

In short, to interact with the project you can:

Issues marked with contributions welcome or good first issue are particularly good places to start. These are great ways to learn more about the inner workings of BTK.

Citing BTK

If you use this software for your research, please cite using the following bibtex entry:

  1. @ARTICLE{mendoza2024btk,
  2. author = {{Mendoza}, Ismael and {Torchylo}, Andrii and {Sainrat}, Thomas and {Guinot}, Axel and {Boucaud}, Alexandre and {Paillassa}, Maxime and {Avestruz}, Camille and {Adari}, Prakruth and {Aubourg}, Eric and {Biswas}, Biswajit and {Buchanan}, James and {Burchat}, Patricia and {Doux}, Cyrille and {Joseph}, Remy and {Kamath}, Sowmya and {Malz}, Alex I. and {Merz}, Grant and {Miyatake}, Hironao and {Roucelle}, C{\'e}cile and {Zhang}, Tianqing and {the LSST Dark Energy Science Collaboration}},
  3. title = "{The Blending ToolKit: A simulation framework for evaluation of galaxy detection and deblending}",
  4. journal = {arXiv e-prints},
  5. keywords = {Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Cosmology and Nongalactic Astrophysics},
  6. year = 2024,
  7. month = sep,
  8. eid = {arXiv:2409.06986},
  9. pages = {arXiv:2409.06986},
  10. doi = {10.48550/arXiv.2409.06986},
  11. archivePrefix = {arXiv},
  12. eprint = {2409.06986},
  13. primaryClass = {astro-ph.IM},
  14. adsurl = {https://ui.adsabs.harvard.edu/abs/2024arXiv240906986M},
  15. adsnote = {Provided by the SAO/NASA Astrophysics Data System}
  16. }