Giter Club home page Giter Club logo

photometry.jl's Introduction

Photometry.jl

Build Status PkgEval Coverage License

Stable Dev

This is a package for performing astronomical photometry using modern and efficient algorithms.

Inspired by photutils, SEP, and AperturePhotometry.jl.

Usage

Here is a basic example to do some aperture photometry using CircularAperture. The photometry function performs the photometry using a given method. Please see the documentation for more examples and reference material.

data = ones(100, 100)
err = ones(100, 100)

ap1 = CircularAperture(50, 50, 3)
# partial overlap
ap2 = CircularAperture(0.5, 0.5, 5)

results = photometry([ap1, ap2], data, err)
@assert results.aperture_sum[1]  9π
@assert results.aperture_sum[2]  25π / 4

results

Output:

Table with 4 columns and 2 rows:
     xcenter  ycenter  aperture_sum  aperture_sum_err
   ┌─────────────────────────────────────────────────
 1 │ 50.0     50.0     28.2743       5.31736
 2 │ 0.5      0.5      19.635        4.43113

Contributing

Please see the to-do list above for project ideas as well as any open issues! If you add new functionality, please add appropriate documentation and testing. In addition, please increment the minor version of the package to reflect the new changes!

License

The work derived from astropy/photutils is BSD 3-clause and the work derived from kbarbary/sep is BSD 3-clause. All other work is considered MIT expat. Therefore this work as a whole is BSD 3-clause. LICENSE contains all licenses and any files using derived work are noted at the top of the file.

photometry.jl's People

Contributors

abhro avatar dependabot[bot] avatar github-actions[bot] avatar helgee avatar mforets avatar mileslucas avatar sefffal avatar siddharthlal25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

photometry.jl's Issues

IDW Interpolator

It would be nice to have an implementation of the Shepard inverse distance weighting interpolation scheme. Astropy has a version here and there's a wikipedia entry, too.

Redundant calling of bbox for circular aperture

Line number 43: creating bounds by calling edges, and edges call bbox internally.
Line number 44: creating a bounding box by calling bbox
Line number 45: getting size, size calls bbox internally
Line number 46: calling circular_overlap but there is no use of the variable created in line 44, because it is not being passed as an argument.

Similarly at

Simple Stats Background Estimation

Following #11 I'd like to get all of the simple statistics background estimation methods implemented and push v0.3.0.

Methods

Note:
You will see that SourceExtractor is commonly abbreviated to SExtractor. Part of the astronomy community, including myself, finds this name inappropriate for various reasons and I would like to always refer to it as SourceExtractor.

Sigma clipping

This involves implementing some basic statistical functions using standard sigma-clipping

sigma_clip(data, sigma_low, sigma_high; center=median, std=std)
sigma_clip(data, sigma; kwargs...) = sigma_clip(data, sigma, sigma; kwargs...)

data is the input data
sigma is the number of sigma to clip with
sigma_low,sigma_high allow asymmetric clipping
center is a function for computing the central value (usually mean or median)
std is a function for computing the spread (usually std)

The function will return the original data with the clipped values imputed with the appropriate max (ie if the original is greater than sigma_high * std + mean then it is replaced with sigma_high * std + mean)

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

Switch to a geometry backend

After spending many hours trying to patch together some code for doing exact overlaps of rectangular apertures, I've decided there has to be a better way. I think there is.

I think there is a way to substantially cut down on the code required for calculating overlaps for aperture photometry by leveraging the code from some JuliaGeometry packages.

The general problems

  • Area of overlap of an arbitrary ellipse (position, semi-major axis, semi-minor axis, position angle) with an axis-aligned rectangle
    This includes the special case of a circle

  • Area of overlap of an arbitrary polygon (points) with an axis-aligned rectangle
    This includes the special case of an arbitrary rectangle (position, width, height, position angle)

Current Implementation

Currently, we only support circular and elliptical overlap, but I'd like to support rectangles and polygons, too. The method for circular and elliptical is some modified version of the Sutherland-Hodgman algorithm. For the circular version, its simple enough to find intersections with the circle and compose the area using triangles and chords.

For the elliptical, we use the transform for the ellipse into the unit circle and apply that to the rectangle's points. This creates a parallelogram (not axis-aligned) which we break into two triangles. These triangles are then fed through a modified Sutherland-Hodgman for their overlap with the unit circle.

Call for help

Performance is important, but I'm more considered about usability and coverage of different geometric types. This is why I think this can be made better using another package, but I don't really know how to use them for this purpose. The point between where we do calculations and transforming our data into geometry types for outsourcing the calculations is also not clear to me (e.g. is it better/faster to calculate area overlap of two triangles and unit-circle or a polygon and unit-circle?)

If there is anyone who can help me find a way to achieve this, I would greatly appreciate it.

RectangularAperture of size 1 gives weights of 0

Hello,

I was trying to use Photometry.jl to generate an aperture around a single pixel, so that it would just extract the value from that one pixel. (I know this is redundant since I could just index that one pixel, but for the sake of consistency I wanted to be able to do this as well). However, it seems like there is a bug in Photometry.jl where trying to generate a rectangular aperture with a width/height of exactly 1 causes all of the weights to be 0:

julia> using Photometry

julia> ap = RectangularAperture(10,10,1.,1.,0.)
2×2 RectangularAperture{Float64} with indices 9:10×9:10:
 0.0  0.0
 0.0  0.0

I would expect it to just give an aperture with indices of 10:10x10:10 with a weight of 1.0. And if I change the width/height to a value slightly above 1, it seems to work as expected:

julia> ap = RectangularAperture(10,10,1+eps(),1+eps(),0.)
2×2 RectangularAperture{Float64} with indices 9:10×9:10:
 0.0  0.0
 0.0  1.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.