reading 1D fits files

Design, construction, tuning of spectroscopes
Information and discussion about softwares (telescope remote, autoguiding, acquisition, spectral processing ...)
Post Reply
Arnold de Bruin
Posts: 6
Joined: Thu Aug 25, 2016 2:28 pm
Location: Bussum

reading 1D fits files

Post by Arnold de Bruin »

Hello all,

At the moment I am busy making a program to model line (Hα) profiles....
Can anybody tell me how to read a 1D fit(s) file in VB?
Now I am using the .dat files generated by ISIS, but it would be nice to be able to read the .fit.

Regards Arnold
Tim Lester
Posts: 168
Joined: Fri Apr 04, 2014 6:31 pm
Location: Arnprior Ontario

Re: reading 1D fits files

Post by Tim Lester »

This NASA documentation will help. It is what I used to write my c# routine for reading 1D fit files in PlotSpectra.
https://fits.gsfc.nasa.gov/fits_primer.html
When it comes to reading the data block I found I had to reverse the byte order to get sensible numbers out.

Here is a link to the source code for my routine. It may help even if you are not familiar with c#.
https://1drv.ms/t/s!AvXqhKI5kEGRjEfjmBdgpWx8yX86

Tim
Arnold de Bruin
Posts: 6
Joined: Thu Aug 25, 2016 2:28 pm
Location: Bussum

Re: reading 1D fits files

Post by Arnold de Bruin »

Great Tim!
Much appreciated :-) and thanks for sharing your code. Although I will be using vb, this will certainly help!
Btw, in my program I added:
If NAXIS>1 message "not a 1D spectrum" to avoid loading a 2D fits file ;-)

Regards Arnold
Post Reply