question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ginga pick gets central position in 1-indexing

See original GitHub issue

While doing my data analysis for PSF photometry, I found my code always give warning because the ginga pick location (which are fed as initial guess to the true centroid) and the DAOStarFinder centroid differ more than 1 pixel all the time.

To test, I made a perfect Gaussian star at center = (31, 31) to a (51, 51) array.

from astropy.modeling.functional_models import Gaussian2D
g = Gaussian2D(amplitude=1, x_mean=31, y_mean=31, x_stddev=2, y_stddev=2)
test = np.zeros((51, 51))
test_xx, test_yy = np.mgrid[:51,:51]
test += g(test_xx, test_yy)

finder = DAOStarFinder(fwhm=5, threshold=0, exclude_border=True)
test_found = finder(test)
test_pos = (test_found["xcentroid"][0], test_found["ycentroid"][0])
print(test_pos)
# (31.0, 31.0)

plt.imshow(test, origin="lower")
plt.plot(*test_pos, 'rx', ms=10)

test_ccd = CCDData(data=test, unit='adu')
test_ccd.write("test.fits", overwrite=True)

The position by DAOStarFinder is correct: (31.0, 31.0) image

But ginga found (32.0, 32.0) image

Maybe I guess this is not expected…?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ejeschkecommented, May 21, 2019

Pick reports location in FITS coordinates (1-based indexing) by default, whereas DAOstarfinder probably uses 0-based indexing. Ginga’s internal reporting is 0-based, however, and you can change the value shown in Pick by adding

pixel_coords_offset = 0

to a text file general.cfg in your $HOME/.ginga folder.

0reactions
ejeschkecommented, May 21, 2019

Might make for some good unit tests, @pllim!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ginga Documentation
Ginga is a toolkit designed for building viewers for scientific image data in Python, visualizing 2D pixel data in NumPy arrays.
Read more >
ginga Documentation - Read the Docs
Ginga is a toolkit designed for building viewers for scientific image data in Python, visualizing 2D pixel data in NumPy arrays.
Read more >
Untitled
Ccie data center india, Bebington civic centre library, Equestrian decor ... Doncaster maplin, Today posted jobs in coimbatore, Gaego, Ar58225 atheros ...
Read more >
3850 PDFs | Review articles in 3D FLOW - ResearchGate
The position of domains of the numerical simulation and the. ... material points that periodically return to their initial position, play a central...
Read more >
Servo Drives & Amplifiers - PicClick CA
Money Back Guarantee ensures YOU receive the item you ordered or get your money back. ... Local pick up can be arranged at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found