Author Topic: Comet registration script?  (Read 10290 times)

Offline zvrastil

  • PixInsight Addict
  • ***
  • Posts: 179
    • Astrophotography
Comet registration script?
« on: 2011 August 29 13:09:22 »
Hi Juan and fellow developers,

based on my work described here http://pixinsight.com/forum/index.php?topic=3351.0, I'd like to try to generalize my comet registration script.
I imagine something with two modes:

Comet registration mode

Inputs:
List of images (calibrated, debayered, star-aligned)
Two reference frames and comet distance between them (pre-measured by user with DynamicAlignment)
Reference frame (images will be comet-registered on this image)
Prefix/postfix for registered frames
Source of time of exposures for each frame (need help with this)

It will compute offsets for each frame using time of the exposure and linear interpolation and create and save shifted images.
Optionally, it would also integrate images with suitable parameters to remove stars as much as possible.

Comet removal mode
 
Inputs:
List of images (calibrated, debayered, star-aligned)
Integrated star-free comet image
Prefix/postfix for processed frames
Source of time of exposures for each frame (need help with this)

It will compute offsets in the same way as previous mode. For each frame, it will shift the integrated comet image, subtract it from the frame and save result.
Optionally, it would also integrate images with suitable parameters to remove possible residuals of the comet.


Problem I don't know how to solve is getting time of exposure for each frame. It can be probably read from original FITs. But calibrated, debayered and star-aligned images probably lost all metadata already. Or am I wrong?
Another problem is when using DSLR. It would be fine to convert RAW metadata to FITs header when converting to FITs using BatchFormatConversion. Then, we have just the previous problem to solve.

Any suggestions are welcome.

thanks, Zbynek

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Comet registration script?
« Reply #1 on: 2011 August 29 15:18:23 »
Hi Zbynek,

For now, simply assume that all of your images have standard DATE-OBS keywords providing the file creation time. As you know the value of this keyword is a date and a time in ISO 8601 format:

YYYY-MM-DDThh:mm:ss

You can use Math.complexTimeToJD() to transform these dates into julian day numbers to facilitate time arithmetics.

Leave to me the work to ensure that the BatchFormatConversion and BatchDebayer scripts preserve the relevant EXIF data when converting DSLR raw images into FITS. This will require new versions of some file support and process modules. I'll try to make the necessary changes and publish the corresponding updates as soon as possible.

Exciting project, by the way ;)
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline zvrastil

  • PixInsight Addict
  • ***
  • Posts: 179
    • Astrophotography
Re: Comet registration script?
« Reply #2 on: 2011 August 29 23:30:03 »
Thanks Juan,

I'll start with that (and also with option to read times from text file to be able to test on my data). There's plenty of other work to be done - mainly user interface.
I have also some ideas to try about automatic detection of comet distance (subtracting first and last frame from each other and measure shift using FFT).

I'll keep you informed.

Zbynek

Offline Yuriy Toropin

  • PixInsight Addict
  • ***
  • Posts: 209
Re: Comet registration script?
« Reply #3 on: 2012 February 10 03:01:12 »
Hi Zbynek,
Comet registration mode
Inputs:
List of images (calibrated, debayered, star-aligned)
Two reference frames and comet distance between them (pre-measured by user with DynamicAlignment)
Reference frame (images will be comet-registered on this image)
Prefix/postfix for registered frames
Source of time of exposures for each frame (need help with this)

It will compute offsets for each frame using time of the exposure and linear interpolation and create and save shifted images.
Optionally, it would also integrate images with suitable parameters to remove stars as much as possible.

Sorry for disturbing you, but are there any news on this particular script?

Without script like this I... well... concerned if I really would like to shot Garradd (and other beauties like it) again or not?

While comets are very interesting objects, manual post-processing with manual registration on the comet's core is boring and error-prone...
(Nonetheless, some examples could be found here or here).

I have one question on workflow described by you -
"Two reference frames and comet distance between them (pre-measured by user with DynamicAlignment)"
It looks like it's possible to extract date:time from fits headers, sort list of images by time, select the first and the last and ask user to identify comet on them.
After that "linear speed" of comet on image will be known.

Anyway - are there any news on the subject?

Thanks a lot for your work!
   Yuriy

Offline zvrastil

  • PixInsight Addict
  • ***
  • Posts: 179
    • Astrophotography
Re: Comet registration script?
« Reply #4 on: 2012 February 10 12:09:09 »
Sorry for disturbing you, but are there any news on this particular script?

Hello Yuriy,

you're welcome. But I'm afraid I have to disappoint you. I have little more than module skeleton. In fact, I haven't written single line of code in my free time since October 2011 (VNG debayering support of PixInsight). There are two main reasons for it. First is that I'm currently working on very interesting and challenging development project in my daily job and my "greed for programming" is usually completely satisfied by this. Second, my two sons are growing (3 years and 1 year) and time spent with them is a lot of fun, but it's growing.
This does not mean I won't continue with this module some time, but I can't make any commitments. Sorry.

I have one question on workflow described by you -
"Two reference frames and comet distance between them (pre-measured by user with DynamicAlignment)"
It looks like it's possible to extract date:time from fits headers, sort list of images by time, select the first and the last and ask user to identify comet on them.
After that "linear speed" of comet on image will be known.

Yes, there's a FITs keyword DATE-OBS that denotes the date/time when the frame was captured. Same information can also be extracted from RAW metadata. The comet movement on the sky background can be considered linear in short period of time (hours, maybe days). So, assuming you know the time for each frame, measuring the comet position in pixels at two frames is enough to interpolate/extrapolate position of the comet on all frames. PJSR Image class provides method translate(dx, dy) which can be used to register all frames on comet (assuming they are already star-registered).
In my semi-manual workflow, I used DynamicAlignment to measure the delta between comet core position on two selected frames. Knowing the times from metadata, I used simple Excel table to calculate delta x and y for each frame and copy/pasted these values to the script to perform the registration.
If you want to try this approach, feel free to ask me for assistance. I'll be glad to help.

best regards, Zbynek

Offline Yuriy Toropin

  • PixInsight Addict
  • ***
  • Posts: 209
Re: Comet registration script?
« Reply #5 on: 2012 February 12 10:19:55 »
Hi Zbynek,
With daughter 3.5 years and just 3 months old I understand what you're talking about, don't worry and take your time! :)
In general, everything is clear, I have just single question on this part
... In my semi-manual workflow, I used DynamicAlignment to measure the delta between comet core position on two selected frames. Knowing the times from metadata, I used simple Excel table to calculate delta x and y for each frame and copy/pasted these values to the script to perform the registration.
If you want to try this approach, feel free to ask me for assistance. I'll be glad to help.
How do you copy date/time info from each FITS frame to Excel?
Thanks a lot for your help,
    Yuriy

Offline zvrastil

  • PixInsight Addict
  • ***
  • Posts: 179
    • Astrophotography
Re: Comet registration script?
« Reply #6 on: 2012 February 12 12:09:47 »
How do you copy date/time info from each FITS frame to Excel?

I loaded all original light frames into DeepSkyStacker. In the bottom part of the window, there's a table showing a lot of metadata for all files. I simply selected all files, right-clicked to get context menu and choosed Copy to Clipboard. Then I pasted the information right into Excel. Screenshot attached.
To be precise, I have RAWs not FITs. But I'm pretty sure DSS will extract metadata from FITs as well.
Since PSJR provides access to FITs metadata, it would be of course possible to read date&time directly in PixInsight. But for one-time manual processing, DSS-Excel workaround seems easier to me.

regards, Zbynek

Offline Yuriy Toropin

  • PixInsight Addict
  • ***
  • Posts: 209
Re: Comet registration script?
« Reply #7 on: 2012 February 13 06:57:39 »
Hi, Zbynek,
thanks a lot for the DSS tip,
will try it on the next occasion!

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Comet registration script?
« Reply #8 on: 2012 March 09 11:47:23 »
Coming soon ;)

Offline Alejandro Tombolini

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1267
    • Próxima Sur
Re: Comet registration script?
« Reply #9 on: 2012 March 09 12:28:04 »
Excellent!. :)  ...DSRL?  I have data if is needed.

Saludos. Alejandro.

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Comet registration script?
« Reply #10 on: 2012 March 09 22:07:59 »
...DSRL? 
Yes, the files was converted from CR2
« Last Edit: 2012 April 09 19:46:12 by NKV »

Offline zvrastil

  • PixInsight Addict
  • ***
  • Posts: 179
    • Astrophotography
Re: Comet registration script?
« Reply #11 on: 2012 March 10 11:57:47 »
Looking forward to :-). As I explained I have currently no time for this project, so I'm glad you took it Nikolay. You're quite productive last months  ;).

regards, Zbynek