Skip to main content

A Python implementation of the ContBin algorithm

Project description

contbin_python

This is a python re-implementation of the Jeremy Sanders contour binning algorithm, which was originally in c++. You can see the original files here: https://github.com/jeremysanders/contbin

Original Copyright Jeremy Sanders jeremy@jeremysanders.net (2002-2016) The reference paper is Sanders (2006), MNRAS, 371, 829, http://adsabs.harvard.edu/abs/2006MNRAS.371..829S

This version was translated to python by me, and might still contain some minor bugs, although the current implementation results seem to reproduce the original code results.

I have additionally added a routine that automatically produces and outputs polygon region files for each bin in sexagesimal coordinates, this is an improvement on the previous work that output many box regions instead.

The jupyter notebook contains the testing code, also an example use case.

This software is licensed under the GNU Public License.

To do:

  • I want to implement PSF information in the code. I will be trying to work on this on another branch.
  • Adding GPU optimization would be wonderful.
  • Making this into a pip package would also be useful. Please stay tuned for updates.

Done:

  • Added polygon regions as output in sexagesimal coordinates, however this requires ciao and pyds9 installed.

Requirements

  • numpy
  • astropy
  • ciao
  • pyds9

Code use case example:

from contour_binning import *

os.chdir("/Users/jpbreuer/Scripts/contbin-python")
inputfile = "scaled_fluxed_sps_filth_fov.fits"

sn_ratio = 50
smooth = 30
constrain_val = 1.5
reg_bin = 1

ContourBin(inputfile, sn_ratio, smooth, constrain_val, reg_bin)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycontbin-0.2.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

pycontbin-0.2.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file pycontbin-0.2.0.tar.gz.

File metadata

  • Download URL: pycontbin-0.2.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.9

File hashes

Hashes for pycontbin-0.2.0.tar.gz
Algorithm Hash digest
SHA256 12728c8cf607afabee306ec14b9b8db011ee39930c5ef45cf44f816fc4cf8d7b
MD5 28f37150bd2d882922d13389eb05c537
BLAKE2b-256 4c1881118bb81bca8051f78fdbc74f8e8eb64090331418f84cc10d4590b144f4

See more details on using hashes here.

File details

Details for the file pycontbin-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pycontbin-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.9

File hashes

Hashes for pycontbin-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fe17f4b45b20c24fa7723c964150e9960754115a8f48137013c36b65df5a70c
MD5 b61796208b7c265c9af4f0cf3e6b2635
BLAKE2b-256 c1fe83980e6fbbfd939f63af42ef27df4e49d81b6486b063272bb702a8edaf97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page