quatrope / ProperImage

Proper Image utils for astronomy.
BSD 3-Clause "New" or "Revised" License
26 stars 6 forks source link

Using my data #73

Open chornelis-08 opened 2 years ago

chornelis-08 commented 2 years ago

Hello sir, I am chornelis, I hope you are in a good condition. I want to finish my thesis about analysis data photometry using your code with my data. But, when i try the tutorial 3, "img=si.SingleImage(img_path)" the error shows like this

RuntimeError Traceback (most recent call last)

in () ----> 1 img=si.SingleImage(img_path) 3 frames /usr/local/lib/python3.7/dist-packages/properimage/single_image.py in __init__(self, img, mask, maskthresh, stamp_shape, borders, crop, min_sources, strict_star_pick, smooth_psf, gain) 120 self.maskthresh = maskthresh 121 self.data = img --> 122 self.mask = mask 123 self._bkg = maskthresh 124 self.stamp_shape = stamp_shape /usr/local/lib/python3.7/dist-packages/properimage/single_image.py in mask(self, mask) 335 for i_enlarge in range(7): 336 enlarged_mask = convolve_scp( --> 337 self.__data.mask.astype(int), np.ones((3, 3)) 338 ) 339 enlarged_mask = enlarged_mask.astype(int) > 2 /usr/local/lib/python3.7/dist-packages/scipy/ndimage/filters.py in convolve(input, weights, output, mode, cval, origin) 753 """ 754 return _correlate_or_convolve(input, weights, output, mode, cval, --> 755 origin, True) 756 757 /usr/local/lib/python3.7/dist-packages/scipy/ndimage/filters.py in _correlate_or_convolve(input, weights, output, mode, cval, origin, convolution) 603 wshape = [ii for ii in weights.shape if ii > 0] 604 if len(wshape) != input.ndim: --> 605 raise RuntimeError('filter weights array has incorrect shape.') 606 if convolution: 607 weights = weights[tuple([slice(None, None, -1)] * weights.ndim)] RuntimeError: filter weights array has incorrect shape. what should i do with that error? Can you help me sir? my regards, chornelis
BrunoSanchez commented 2 years ago

Hi, this issue seems to be related with the mask setting. Apparently it fails to enlarge the mask. What kind of data are you using? Are these telescope images? Is the format of a fits data file? Do they have a mask plane? Do they have a gain key in their header? I think this information is important for the software to function properly.

chornelis-08 commented 2 years ago

yes sir, thanks for you comment. The data is a telescope images and the format is fit. My data only using standard reducing (dark, bias and flat) without mask plan. And the data have gain key. I attach header of my data, SIMPLE = T
BITPIX = 16 /8 unsigned int, 16 & 32 int, -32 & -64 real
NAXIS = 2 /number of axes
NAXIS1 = 1530 /fastest changing axis
NAXIS2 = 1020 /next to fastest changing axis
BSCALE = 1.0000000000000000 /physical = BZERO + BSCALEarray_value
BZERO = 32768.000000000000 /physical = BZERO + BSCALE
array_value
DATE-OBS= '2015-08-28T11:53:28' /YYYY-MM-DDThh:mm:ss observation start, UT
EXPTIME = 25.000000000000000 /Exposure time in seconds
EXPOSURE= 25.000000000000000 /Exposure time in seconds
SET-TEMP= -10.000000000000000 /CCD temperature setpoint in C
CCD-TEMP= -10.203084036736080 /CCD temperature at start of exposure in C
XPIXSZ = 9.0000000000000000 /Pixel Width in microns (after binning)
YPIXSZ = 9.0000000000000000 /Pixel Height in microns (after binning)
XBINNING= 1 /Binning factor in width
YBINNING= 1 /Binning factor in height
XORGSUBF= 0 /Subframe X position in binned pixels
YORGSUBF= 0 /Subframe Y position in binned pixels
FILTER = 'Bessel R' / Filter used when taking image
IMAGETYP= 'Light Frame' / Type of image
FOCUSPOS= 13109 /Focuser position in steps
FOCUSSSZ= 0.00000000000000000 /Focuser step size in microns
OBJECT = 'ngc6494-bslr-25s'
OBJCTRA = '17 57 01' / Nominal Right Ascension of center of image
OBJCTDEC= '-18 59 45' / Nominal Declination of center of image
OBJCTALT= ' 76.0436' / Nominal altitude of center of image
OBJCTAZ = '151.4330' / Nominal azimuth of center of image
OBJCTHA = ' -0.4671' / Nominal hour angle of center of image
PIERSIDE= 'WEST ' / Side of pier telescope is on
SITELAT = '-06 49 00' / Latitude of the imaging location
SITELONG= '107 36 58' / Longitude of the imaging location
JD = 2457262.9954629629 /Julian Date at start of exposure
JD-HELIO= 2457262.9980319054 /Heliocentric Julian Date at exposure midpoint
AIRMASS = 1.0305493990373527 /Relative optical path length through atmosphere FOCALLEN= 1758.0000000000000 /Focal length of telescope in mm
APTDIA = 280.00000000000000 /Aperture diameter of telescope in mm
APTAREA = 54457.122554969785 /Aperture area of telescope in mm^2
EGAIN = 2.6199998855590820 /Electronic gain in e-/ADU
SWCREATE= 'MaxIm DL Version 5.24 131112 2W8HJ' /Name of software that created
the image
SBSTDVER= 'SBFITSEXT Version 1.0' /Version of SBFITSEXT standard in effect
TELESCOP= ' ' / telescope used to acquire this image
INSTRUME= 'SBIG ST-8 3 CCD Camera'
OBSERVER= ' '
NOTES = ' '
FLIPSTAT= ' '
SWOWNER = 'brtx2 ' / Licensed owner of software
INPUTFMT= 'FITS ' / Format of file from which image was read
SWMODIFY= 'MaxIm DL Version 5.24 131231 0Y1SR' /Name of software that modified
the image
HISTORY Bias Subtraction (Bias 1, 1530 x 1020, Bin1 x 1, Temp -10C,
HISTORY Exp Time 0ms)
CALSTAT = 'BDF '
HISTORY Dark Subtraction (Dark 2, 1530 x 1020, Bin1 x 1, Temp -10C,
HISTORY Exp Time 25s)
HISTORY Flat Field (Flat Bessel R 1, Bessel R, 1530 x 1020, Bin1 x 1,
HISTORY Temp -10C, Exp Time 3s)
PEDESTAL= -100 /Correction to add for zero-based ADU
ANMISCH = '1 arc sec'
ANMISLE = '400 '
ANMISLG = '1 '
ANM00000= '""'
CSTRETCH= 'Medium ' / Initial display stretch mode
CBLACK = 401 /Initial display black level in ADUs
CWHITE = 1022 /Initial display white level in ADUs

thanks sir, chornelis

chornelis-08 commented 2 years ago

Sir, i try to use mask on tutorial 1 proper image to my data and it works.

chornelis-08 commented 2 years ago

But i will sure for the mask that i should use. Have you any suggestion for me?

thanks sir

BrunoSanchez commented 2 years ago

Sorry, can you send me more info? Maybe I can look at your images/masks and check for details that might be relevant. Do you have any results to show? Is it working well the subtraction?

chornelis-08 commented 2 years ago

https://colab.research.google.com/drive/1_k6JW3yTu7JqaDwODcX15XbZG7o3LTcz#scrollTo=heY9PZP55q6z can you access my code on this site. And my data in this drive sir. https://drive.google.com/drive/folders/1xJcQijzBpfZAOwa0uXC_S6kxPGl7H_ew

chornelis-08 commented 2 years ago

Sorry, can you send me more info? Maybe I can look at your images/masks and check for details that might be relevant. Do you have any results to show? Is it working well the subtraction?

actually, know, i am still working to get good reference image. So, i haven't done the subtraction process.

BrunoSanchez commented 2 years ago

OK, I just checked and I will need access. But whenever you get to the subtraction stage post the results here, then I will look.

chornelis-08 commented 2 years ago

OK, I just checked and I will need access. But whenever you get to the subtraction stage post the results here, then I will look.

ok sir, i will try

chornelis-08 commented 2 years ago

Sir, can i get your email?

chornelis-08 commented 2 years ago

data.pdf sir, this is the document that i try subtraction stage, if you cannot access, please let me know,

my regards, chornelis

BrunoSanchez commented 2 years ago

Yes I could access it. Is this synthetic data? It looks like the PSF is quite broad and as if every star had the same brightness. What calibration are you applying to your pixel data? Are you converting to photoelectrons or using counts?

chornelis-08 commented 2 years ago

yes, this is from the observation process. yes, this PSF is quite broad and every star had the same brightness because this project is try to find out variable star from open cluster. And when we using differential photometry, we find that some star as a variable star, so i want to compare the result with same data but using properimage method. the data using counts.

BrunoSanchez commented 2 years ago

OK, it appers to me that the mask is quite strange. It seems to be masking out sources. From what I can see, you should have a nice subtraction. Additionally I see some hot pixels in the background, are you applying flat, bias dark and cosmic ray cleaning?

chornelis-08 commented 2 years ago

"It seems to be masking out sources", yes and now, i try to find out another way for masking, do you have paper or something about masking process that should I read? Because, it something new for me. For, flar, bias dark and cosmic ray, its done.

BrunoSanchez commented 2 years ago

OK, why don't you just let the mask out. Try subtracting using the paths:

result = subtract(
    ref=ref_path,
    new=new_path,
    smooth_psf=False,
    fitted_psf=True,
    align=False,
    iterative=False,
    beta=False,
    shift=False
)

where ref_path and new_path are the paths to the images in your local disk.

Or as the readme states:

>>> from properimage.operations import subtract
>>> D, P, Scorr, mask = subtract(ref=ref_path, new=new_path, smooth_psf=False, fitted_psf=True,
...                             align=False, iterative=False, beta=False, shift=False)

For the case, why don't you just try with the fitted_psf=True as the readme shows.

chornelis-08 commented 2 years ago

Ok sir, thanks for you suggestion. I will try

chornelis-08 commented 2 years ago

OK, why don't you just let the mask out. Try subtracting using the paths:

result = subtract(
    ref=ref_path,
    new=new_path,
    smooth_psf=False,
    fitted_psf=True,
    align=False,
    iterative=False,
    beta=False,
    shift=False
)

where ref_path and new_path are the paths to the images in your local disk.

Or as the readme states:

>>> from properimage.operations import subtract
>>> D, P, Scorr, mask = subtract(ref=ref_path, new=new_path, smooth_psf=False, fitted_psf=True,
...                             align=False, iterative=False, beta=False, shift=False)

For the case, why don't you just try with the fitted_psf=True as the readme shows.

I used this one, But the error shows like this

RuntimeError Traceback (most recent call last)

/usr/local/lib/python3.7/dist-packages/properimage/operations.py in subtract(ref, new, align, inf_loss, smooth_psf, beta, shift, iterative, fitted_psf) 113 try: --> 114 ref = SI(ref, smooth_psf=smooth_psf) 115 except: # noqa

6 frames

RuntimeError: filter weights array has incorrect shape.

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)

/usr/local/lib/python3.7/dist-packages/properimage/operations.py in subtract(ref, new, align, inf_loss, smooth_psf, beta, shift, iterative, fitted_psf) 115 except: # noqa 116 try: --> 117 ref = SI(ref.data, smooth_psf=smooth_psf) 118 except: # noqa 119 raise

AttributeError: 'str' object has no attribute 'data'

chornelis-08 commented 2 years ago

Hello sir, can you help me to explain about the step after get D, Pd, and Scorr? How can we get the flux of transient object or variable stars?

my regards, chornelis

BrunoSanchez commented 2 years ago

I am very sorry. I just can get back at this. What is the current state?