Thursday 25 June 2015

JPEG to FITS

There are various ways to convert JPEG files to FITS files:

The easiest are:

1. Linux terminal:   convert  <filename.jpeg>   <filename.fits>

2. MATLAB:          import filename.jpeg;
                                fitswrite(filename,'new_filename.fits')

Problem:
Both these ways produce a default header with minimal information on the newly created fits file.

Example: A header from  .fts file from BBSO  (required):

SIMPLE  =                    T / Written by IDL:   6-Jul-2000 13:21:53.00      
BITPIX  =                   16 /                                              
NAXIS   =                    2 /                                              
NAXIS1  =                 2032 /                                              
NAXIS2  =                 2032 /                                              
BZERO   =              0.00000 /                                              
BSCALE  =              1.00000 /                                              
OBJECT  = 'SUN'                /                                              
TYPE-OBS= 'FULLDISK'           /                                              
SEEING  =                    0 / VERY POOR                                    
CRPIX1  =           1016.50000 /                                              
CRPIX2  =           1016.50000 /                                              
CDELT1  =              1.05440 /                                              
CDELT2  =              1.05440 /                                              
CTYPE1  = 'ARCSEC'             / WEST POSITIVE                                
CTYPE2  = 'ARCSEC'             / NORTH POSITIVE                                
CRVAL1  =                    0 /                                              
CRVAL2  =                    0 /                                              
TIME-OBS= '15:43:18'           / START OF 30 MS EXPOSURE                      
DATE-OBS= '2000-07-06'         /                                              
DATE_OBS= '2000-07-06T15:43:18.000Z' /                                        
ORIGIN  = 'BBSO'               / BIG BEAR LAKE, CA                            
TELESCOP= 'SINGER'             /                                              
WAVELNTH= 'HALPHA'             /                                              
OBSERVER= 'XXX'                /                                              
EXPTIME =              0.03000 / SECONDS                                      
TEC_TEMP=                    0 / DEGREES C                                    
COMMENT   ORIGIN FILE NAME h706l.fts                                          
ASP     =              1.00000 / Raw image aspect ratio                        
CENX    =                 1017 / Raw image disk center X                      
CENY    =                 1018 / Raw image disk center Y                      
MAXC    =                 6210 / Quiet Sun Max Brightness                      
WIDT    =              1771.00 / Width of disk (pixels)                        
END                                                                            

The header of a JPEG to FITS converted file:

SIMPLE  =                    T
BITPIX  =                    8
NAXIS   =                    2
NAXIS1  =                 2032
NAXIS2  =                 2032
BSCALE  =         1.000000E+00
BZERO   =         0.000000E+00
DATAMAX =         2.550000E+02
DATAMIN =         0.000000E+00   
        END


Since the information in the header is important for the analysis of fits files using the AAFDCC code, we need to add appropriate headers to the converted fits files. 

Now, I am trying to understand what each quantity in the header of a fits file created by BBSO means. After I figure that out, I will have to find ways to extract these quantities from the JPEG images and write them to the headers of the converted fits files. 
                             

 

JPEG files from 1997 to 2000


The all corrected (FR) JPEG files from years 1997 to 2000 do not have the same pixel size. Their image sizes vary from 1835 X 1835 to 2032 X 2032.

The images from July 2000 onwards which have been analyzed by the AAFDCC code have a resolution of 2032 X 2032 pixels. So, all the JPEG images were rescaled to meet the required pixel size of 2032 X 2032.

A simple terminal command can resize all images to 2032 X 2032:
convert     <filename>    -resize    2032x2032      <newfilename>

 Example:

Original 1835 X 1835 image
Resized 2032 X 2032 image

A Solar filament in the original image
The same Solar filament in the resized image
                           
                            

Purpose of the Project

The purpose of this project is to compare the manual filament chirality determinations of Yeates et. al. (2007) with the chirality determinations of the AAFDCC code written by Bernasconi et. al. (2005). This code is designed to detect, track and characterize filaments by extracting their various properties like size, chirality, etc.

The problem:

The AAFDCC code runs on .fits files of H-alpha observations from the Big Bear Solar Observatory (BBSO) which are available from 6th July 2000 to present. Whereas, Yeates et. al. have determined chiralities of filaments in the year 1999 from .jpeg images taken at BBSO. Therefore, there is no overlap in these datasets where we could make a comparison.


Project:

BBSO has been observing the Sun in H-alpha and Ca II since a long time. Their data stream stretches back to 1982, but it is rather discontinuous in the 1980s and the 1990s.



We are targeting the time period between 1997 and 2000 to come up with a routine that can convert the all corrected (FR) JPEG images to fits files with appropriate header information so that they can be analyzed by the AAFDCC code and we can compare the results of the code with the manual chirality determination by Anthony Yeates.