Author Topic: FITSFileManager  (Read 18336 times)

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
FITSFileManager
« on: 2012 August 23 13:57:43 »
I have significantly modified the FITS_key that copy files based on FITS keywords, it was written by of Nicolay (I hope he doesn't mind).
FITS File manager support generating a file path from the FITS keyword in a flexible way (using a pattern). The file path can include commonly used FITS keywords, parts of the original file name and a count which can be based on selected elements (typically the target directory, but could be the filter or other variables).

The script is attached. This scripts move and copy files, it is potentially dangerous, use at your own risk (however I use it on my machine).
Preferably use load/saveas so that the orignal name of the file is saved as a fits keyword.

Thanks to Nicolay for the original contribution. All bugs are mine.
There is an Help included (button at bottom right)

[EDITED Feb 10, 2013 - Version 1.0 attached for PI 1.7, should be part of an update in version 1.8]

-- bitli
« Last Edit: 2013 February 10 02:20:10 by bitli »

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: FITSFileManager
« Reply #1 on: 2012 September 26 12:37:42 »
Version 0.6 released, with many enhancements. First post updated.

This script can help sorting out FITS files, especially the ones received from remote observatories or recorded with a less than optimal file naming scheme.
The full project source is also available at https://bitbucket.org/bitli/fitsfilemanager.

Using the Load/SaveAs operation, an ORIGFILE keyword is added with the original file name (if it does not already exsit), so you can still relate the rnamed/moved file to its original file.

This should work on other OS but was only tested on Windows. If somebody try it on another OS, feedback would be appreciated.

-- bitli

Offline Josh Lake

  • PixInsight Old Hand
  • ****
  • Posts: 424
Re: FITSFileManager
« Reply #2 on: 2012 October 07 10:27:48 »
Thanks for writing this, it will be very handy for me! I occasionally help others get into processing, and sometimes their filenames are just terrible to work with. This will enormously simplify my workflow with them.

Offline astrospotter

  • Newcomer
  • Posts: 41
Re: FITSFileManager
« Reply #3 on: 2012 October 21 11:08:42 »
Took this for a test drive and it looks very nicely done and very useful.  For some time now I have often been doing rename from the  MaximDL format to nicer names that sort well and group like exposures in windows file manager by name  using a command line perl script I wrote so rename for me is my #1 usage.   You have 'upped the game' with this very nice tool and thanks!

The preview and check you have supplied are critical for any tool that modifies data or filenames so that too is 'spot on'.

Your pop-up help menu that indicates the & format mapping is also spot on and very professional.   Nice.

Very nicely done.  AND since you have been generous enough to supply source I will not ask for a 'rename' button as will look into that myself.   Of course for rename the output directory would be a non-required parameter.

Again, very nicely done and I am quite grateful for your contribution to the PI community.

Thanks!
Mark Johnston

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: FITSFileManager
« Reply #4 on: 2012 October 21 17:35:51 »
Thanks. If you add some function, i would be glad if you provide the patch, si I could include it in future releases. Consider starting from the latest sources in bitbucket, as I corrected some problems. Right now I am in Acatama, so I will not follow this thread very often for a week.
-- bitli

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Re: FITSFileManager
« Reply #5 on: 2012 November 06 06:32:27 »
Hi,

Thank you very much for your development.

I have a problem: my images don't have standard keyword names. For example, the filter is specified in the keyword "INSFLNAM". I've tried to change the line 20 of the engine JSH file:

Code: [Select]
this.defaultKey = ["CCDTEMP","EXPTIME","IMAGETYP","INSFLNAM  ", "CDELT1","CDELT2"];
But this doesn't work. Any ideas?


Thank you again.
Best regards,
Vicent.

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: FITSFileManager
« Reply #6 on: 2012 November 07 07:08:02 »
Hi,
The defaultKey list only specifies the default keywords shown in the FITS window. I will have a look and I will describe how to change the keywords.
Note that in some cases the script is also aware of the format of the data.  It would be useful if you can post an image with your keywords, so I can test it (you may try to make a very small image to save space, just be sure that it has your original FITS keywords).
-- bitli

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Re: FITSFileManager
« Reply #7 on: 2012 November 08 10:00:27 »
Hi,

Thank you. I've just uploaded a cropped FITS file (512x512, the original was 2Kx2K approx.).

The keywords are not standard (and I cannot do anything to change them):

CCDTEMP --> CCD temperature
EXPTIME --> Exposure time
IMAGETYP --> Image type
INSFLNAM --> Filter
CDELT2 --> X binning
CDELT2 --> Y binning

I'm also interested in classifying the images by object name (keyword OBJECT). Could this be possible?


Best regards,
Vicent.

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: FITSFileManager
« Reply #8 on: 2012 November 11 13:31:44 »
Hello,
I have attached a version 0.7 which should be easy to use with your requirements (I hope). The public source repository is also up to date.

The line #define USE_ALTERNATE_KW false should be modified to true to use your keywords (in the original files it is in the -gui.js). The remapping rules are just a few lines below, you can change the FITS keywords as required.

In addition the OBJECT keyword is copied to the &object; synthethic keyword, but without non alphanumeric characters (to avoid creating baroque file names). The method filterObjectName implements the rules to clean OBJECT and can be easily adapted. It is at the end of the -helpers file in the original sources. I am interested in your feedback as to how to best cleanup such textual parameters.

In addition I have implemented the reading of the HIERARCH convention, so your extended keywords can be seen in the FITS keyword window as well and used as source for the synthethic keywords. It is not yet possible to directly refernce a non synthethic &FITS; keyword, but this should come soon.

I will have to find a way to group the "localizable" rules in a file so the source must not be patched at each release, but I am not yet sure how to do it.

[EDITED FEB 2013  - attachment removed, see first post for latest download]

Hope this help, if it is OK I will make a general release.

-- bitli

« Last Edit: 2013 February 10 02:20:58 by bitli »

Offline Chris Cappelli

  • Newcomer
  • Posts: 3
    • CCD Sky Observatory
Re: FITSFileManager
« Reply #9 on: 2012 November 25 12:16:10 »
Thank you for providing this script.  It works great on my Mac OSX Mountain Lion.  There is a minor issue with the dialog not displaying correctly (text on form is jumbled) until form is manually resized.

-Chris.

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: FITSFileManager
« Reply #10 on: 2013 January 17 12:49:00 »
Version 1.0RC1 has been attached to the first script.
The configuration part has been entirely re-written to be more flexible and hopefully work on Mac and Linux. It is also somewhat more complicated, there are tool tips which should help.

This work on 1.7, it also kind of work on 1.8RC1, except parameters.

I would appreciate if somebody can test it on Mac and Linux.

The full sources and tests are available in https://bitbucket.org/bitli/fitsfilemanager.
Cheers,
-- bitli

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: FITSFileManager
« Reply #11 on: 2013 January 23 13:30:36 »
It seems to work on 1.8RC2. I also tested it on Fedora 17 64 bits on a VirtualBox, the latest version of the script seems to work (I made just a couple of tests) and does not have dialog layout issue on my machine. 
On fedora you have to right click on the window bar to close the help window explicitely (there may be other ways...)
 -- bitli

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
FITSFileManager - 1.0
« Reply #12 on: 2013 February 10 02:30:12 »
Version 1.0 is available with minor updates and hopefully better behavior on small screens (I am unable to test on Mac however).  It is available as a single file in the first post for PI 1.7.

It should be part of 1.8 next update or as a later update. The runtime files for 1.0 are availables at https://bitbucket.org/bitli/fitsfilemanager/src/d23c7af704fe/main/js?at=v1.0, the whole project (current development, test files) is also available at https://bitbucket.org/bitli/fitsfilemanager.

The usage of the script may require some familiarity of writing templates, possibly even a regular expression for advanced usage.  I am thinking on a simpler interface (kind of select operations from a list), but this may take some time.

If you have layout problems, please send me a screen dump, the version of the PI and script used, and an information of your OS and screen size.

-- bitli

Offline Geoff

  • PixInsight Padawan
  • ****
  • Posts: 908
Re: FITSFileManager
« Reply #13 on: 2013 February 12 22:50:06 »
Hi Bitli
This looks useful.  However, as I understand it, the script generates a filename based on a choice of fits keywords that are already in the file.  Some processes (eg batch preprocessing, image integration) don't preserve all the fits keywords from the component images.  For instance, after creating a master dark via batch preprocessing, the temperature is not shown in the master dark and I would like this to appear in the new filename.  Is there any obvious way around this?
Geoff
Don't panic! (Douglas Adams)
Astrobin page at http://www.astrobin.com/users/Geoff/
Webpage (under construction) http://geoffsastro.smugmug.com/

Offline Philippe B.

  • PixInsight Old Hand
  • ****
  • Posts: 399
    • CIEL AUSTRAL
Re: FITSFileManager
« Reply #14 on: 2013 February 12 23:30:57 »
Hi Jean-Marc
Very useful scrip. Many thanks ! And thanks for the demo of your scripts during AIP Pixinsight training.
I will test on OSX for display layout, I will let you know. Too much busy right now.
Philippe