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.

How to build ePSF with provided star fits

See original GitHub issue

I tried to obtain the star PSF for a very large image of HST. The original image was huge, I tried to obtain the stars first and put them into individual fits. After subtracted the background and masked some contamination sources, I wanted to use the EPSFBuilder to combine these processed stars images and generate an effect native PSF. There were nearby sources around the original stars so I mask these regions with numpy.nan.

I followed the same method from the example document. I read the values of the stars and stored in a numpy array called “stars_sci” and then combined the data with np.hstack.

data=numpy.hstack(star_sci)

#Then I just follow the same code from the example document.

import matplotlib.pyplot as plt
from astropy.visualization import simple_norm
from photutils import datasets
from photutils.datasets import make_noise_image
peaks_tbl = find_peaks(data, threshold=5000)  
peaks_tbl['peak_value'].info.format = '%.8g'  # for consistent table output  
print(peaks_tbl)  
size = 25
hsize = (size - 1) / 2
x = peaks_tbl['x_peak']  
y = peaks_tbl['y_peak']  
mask = ((x > hsize) & (x < (data.shape[1] -1 - hsize)) &
            (y > hsize) & (y < (data.shape[0] -1 - hsize)))  
from astropy.table import Table
stars_tbl = Table()
stars_tbl['x'] = x[mask]  
stars_tbl['y'] = y[mask]  

from astropy.stats import sigma_clipped_stats
mean_val, median_val, std_val = sigma_clipped_stats(data, sigma=2.)  
data -= median_val  
#The extract_stars() function requires the input data as an NDData object. An NDData object is easy to create from our data array:

from astropy.nddata import NDData
nddata = NDData(data=data)  

from photutils.psf import extract_stars
stars = extract_stars(nddata, stars_tbl, size=25) 

The stars looked ok DeepinScreenshot_select-area_20190822223031 However, the final EPSF was very strange. I didn’t know what happened and why the shape looked so irregular. DeepinScreenshot_select-area_20190822223055

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:19 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
cloud182commented, Nov 15, 2019

Hi,

Yes, I’m not setup to use the development build, but as soon as the 0.7.2 comes out I’ll give it a try.

Thanks for your work, Enrico

Il giorno ven 15 nov 2019 alle ore 15:58 Erik Tollerud < notifications@github.com> ha scritto:

@oxno2 https://github.com/oxno2 and @cloud182 https://github.com/cloud182 - we think #974 https://github.com/astropy/photutils/pull/974 should have solved this problem. Can you give the latest development build of photutils a try? (Or if you aren’t set up to install from source, try it when 0.7.2 comes out.) If that addresses your problems here, we can close this issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/astropy/photutils/issues/951?email_source=notifications&email_token=AI5DOBJGKPNYWG2FOFMG2F3QT3WODA5CNFSM4IO3LET2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEGMRPA#issuecomment-554485948, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI5DOBKOHEUODUJTENV2N3TQT3WODANCNFSM4IO3LETQ .

1reaction
eteqcommented, Nov 15, 2019

@oxno2 and @cloud182 - we think #974 should have solved this problem. Can you give the latest development build of photutils a try? (Or if you aren’t set up to install from source, try it when 0.7.2 comes out.) If that addresses your problems here, we can close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - How to build ePSF with provided star fits -
I tried to obtain the star PSF for a very large image of HST. The original image was huge, I tried to obtain...
Read more >
Building an effective Point Spread Function (ePSF) - Photutils
To begin, we must first define a sample of stars used to build the ePSF. Ideally these stars should be bright (high S/N)...
Read more >
Energy Panel Structures Dealer Network
ENERGY STAR & Green Build EPS is proud to work with our builders who are ENERGY STAR Partners to provide the products and...
Read more >
Fit type for curve and surface fitting - MATLAB fittype
Construct fit types by specifying library model names. Construct a fittype object for ... Warning: Start point not provided, choosing random start point....
Read more >
Point-spread Function Photometry for Impatient Astronomers
NASA's Kepler mission provided photometry of over 400,000 stars ... of the ePSF/PRF, this method usually fits for both position and flux.
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