tag:blogger.com,1999:blog-59016074207923651102024-03-05T04:20:01.038-05:00Filament Chirality, Caibration of AAFDCCSushant Mahajanhttp://www.blogger.com/profile/12958955029511994178noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-5901607420792365110.post-44452290962382984392015-10-03T16:59:00.002-04:002015-10-03T16:59:31.726-04:00Testing the Compatibility of converted JPEGs with AAFDCC<div dir="ltr" style="text-align: left;" trbidi="on">
Efforts continue to contact Dr. Bernasconi to request him to run his code on the converted images and see if they are compatible or have any issues. </div>
Sushant Mahajanhttp://www.blogger.com/profile/12958955029511994178noreply@blogger.com0tag:blogger.com,1999:blog-5901607420792365110.post-52676864710113136522015-10-03T16:04:00.002-04:002015-10-03T16:46:39.258-04:00Complete Procedure 1.0<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: orange;"><span style="font-size: large;">STEP1: RESIZE to 2032x2032</span></span><br />
<br />
<br />
In the folder where you have all the original JPEG images:<br />
<br />
<br />
for file in *.jpg; do convert $file -resize 2032x2032 resized_$file; done<br />
<br />
<br />
<span style="color: orange;"><span style="font-size: large;">STEP2: CONVERT to .fits files</span></span><br />
<br />
a. Move the resized JPEGS to a new folder and convert them to .fits files:<br />
<br />
for file in *.jpg; do convert $file $file.fits; done<br />
<br />
b. Create a list of the resized_ filenames for the next step:<br />
<br />
ls | grep -i "resized" > filenames.txt<br />
<b><span style="font-size: large;"><br /></span></b>
<span style="color: orange;"><span style="font-size: large;">STEP3: Extract the TIME, DATE, Solar disk CENTER(X,Y) and disk RADIUS from resized JPEG images in MATLAB</span></span><br />
<br />
<date_time_circles.m><br />
<br />
[names]=strcolread('filenames.txt',153,42);<br />
% 153= # of files<br />
% 42= length of the string of each filename<br />
% (including a return at the end of each filename)<br />
<br />
yy=names(:,23:26); % Year<br />
mm=names(:,27:28); % Month<br />
dd=names(:,29:30); % Day<br />
hh=names(:,32:33); % Hours<br />
min=names(:,34:35); % Minutes<br />
ss=names(:,36:37); % Seconds<br />
<br />
for n=1:153<br />
timeobs(n,:)=[hh(n,:),':',min(n,:),':',ss(n,:)];<br />
dateobs(n,:)=[yy(n,:),'-',mm(n,:),'-',dd(n,:)];<br />
date_obs(n,:)=[yy(n,:),'-',mm(n,:),'-',dd(n,:),'T',hh(n,:),':',min(n,:),':',ss(n,:),'.000Z'];<br />
end<br />
<br />
data=horzcat(timeobs,dateobs,date_obs);<br />
dlmwrite('date_time.txt',data,'delimiter','');<br />
<br />
% Extracting the Center of the Solar Disk and its radius:<br />
<br />
for n=1:153<br />
[centers(n,:), radii(n), metric(n)] = imfindcircles(imread(sprintf(names(n,1:end-1))), [950 1000], ...<br />
'Sensitivity',0.9900,'EdgeThreshold',0.01,'Method','TwoStage','ObjectPolarity', 'Bright');<br />
end<br />
<br />
centers(:,3)=radii';<br />
centers2=round(centers);<br />
fileid=fopen('circle_info.txt','w')<br />
for n=1:153<br />
fprintf(fileid,'%d %d %d\n',centers2(n,1),centers2(n,2),centers2(n,3));<br />
end<br />
fclose(fileid);<br />
<br />
<br />
<br />
This routine will take hours to run for more than 150 files.<br />
<br />
Move the new files <date_time.txt> and <circle_info.txt> to the folder containing the converted .fits files<br />
<br />
<date_time.txt> should have a single column of stings joined together.<br />
<br />
<span style="font-size: large;"><br /></span>
<span style="color: orange;"><span style="font-size: large;">STEP4: Appending the header</span></span><br />
<br />
a. Create a list of all file names for .fits files:<br />
<br />
ls | grep -i "fits" > filenames.txt<br />
<br />
b. Move the file <edit_header.py> to the directory containing all .fits files, <filenames.txt>, <date_time.txt> and <circle_info.txt>.<br />
<br />
c. Change the number of filenames in the Python code to be equal to the entries you have in <filenames.txt><br />
<br />
d. Open a terminal and type:<br />
<br />
chmod +x edit_header.py<br />
<br />
./edit_header.py<br />
<br />
<br />
And watch magic happen, the headers of all .fits files are changed!</div>
Sushant Mahajanhttp://www.blogger.com/profile/12958955029511994178noreply@blogger.com0tag:blogger.com,1999:blog-5901607420792365110.post-51482863701627926082015-10-01T15:42:00.000-04:002015-10-01T15:43:09.530-04:00Known and Unknown parameters<div dir="ltr" style="text-align: left;" trbidi="on">
Some parameter values in the header are the same for all images, and some of them don't matter for the analysis of the AAFDCC. So, these values will be added to the header of the converted fits files:<br />
<br />
OBJECT='SUN'<br />
TYPE-OBS='FULLDISK'<br />
SEEING=0 / I don't think this matters for the analysis<br />
CDELT1=1.05440 / This quantity is the same for all images <br />
CDELT2=1.05440 / <br />
CTYPE1='ARCSEC'<br />
CTYPE2='ARCSEC'<br />
CRVAL1=0 / I don't really know what this means, but it is always 0<br />
CRVAL2=0 <br />
ORIGIN='BBSO'<br />
TELESCOPE='SINGER'<br />
WAVELNTH='HALPHA'<br />
OBSERVER='X'<br />
EXPTIME=0.04000 / Observing times vary from 0.025 to 0.05 seconds, but it probably doesn't matter for AAFDCC. Even if it does, there is no way to derive the exposure time.<br />
TEC_TEMP=0 / There is no way to extract this from the images<br />
ASP=1.00000 / Raw image aspect ratio<br />
<br />
<br />
The remaining parameters listed below can be extracted from the converted images:<br />
<br />
# By analysis of the solar disk, detecting its center and radius: <br />
CRPIX1= / Central pixel in X<br />
CRPIX2= / Central pixel in Y<br />
CENX= / Raw image disk center X<br />
CENY= / Raw image disk center Y<br />
WIDT= / Width of the disk (pixels) <br />
MAXC= / Quiet Sun Max Brightness (probably won't be able to extract this)<br />
<br />
# From the filename:<br />
TIME-OBS='hh:mm:ss' / From the filename<br />
DATE-OBS='yyy-mm-dd' / From filename<br />
DATE_OBS='yyy-mm-ddThh:mm:ss.000Z' /<br />
<br />
<br />
Now, the job is to actually extract these parameters and write them in the filename headers.<br />
<br /></div>
Sushant Mahajanhttp://www.blogger.com/profile/12958955029511994178noreply@blogger.com0tag:blogger.com,1999:blog-5901607420792365110.post-39416381182911072032015-06-25T18:49:00.002-04:002015-06-25T18:49:10.217-04:00JPEG to FITS<div dir="ltr" style="text-align: left;" trbidi="on">
There are various ways to convert JPEG files to FITS files:<br />
<br />
The easiest are:<br />
<br />
1. Linux terminal: convert <filename.jpeg> <filename.fits><br />
<br />
2. MATLAB: import filename.jpeg;<br />
fitswrite(filename,'new_filename.fits')<br />
<br />
<b>Problem:</b><br />
Both these ways produce a default header with minimal information on the newly created fits file.<br />
<br />
Example: A header from .fts file from BBSO (required):<br />
<br />
SIMPLE = T / Written by IDL: 6-Jul-2000 13:21:53.00 <br />
BITPIX = 16 / <br />
NAXIS = 2 / <br />
NAXIS1 = 2032 / <br />
NAXIS2 = 2032 / <br />
BZERO = 0.00000 / <br />
BSCALE = 1.00000 / <br />
OBJECT = 'SUN' / <br />
TYPE-OBS= 'FULLDISK' / <br />
SEEING = 0 / VERY POOR <br />
CRPIX1 = 1016.50000 / <br />
CRPIX2 = 1016.50000 / <br />
CDELT1 = 1.05440 / <br />
CDELT2 = 1.05440 / <br />
CTYPE1 = 'ARCSEC' / WEST POSITIVE <br />
CTYPE2 = 'ARCSEC' / NORTH POSITIVE <br />
CRVAL1 = 0 / <br />
CRVAL2 = 0 / <br />
TIME-OBS= '15:43:18' / START OF 30 MS EXPOSURE <br />
DATE-OBS= '2000-07-06' / <br />
DATE_OBS= '2000-07-06T15:43:18.000Z' / <br />
ORIGIN = 'BBSO' / BIG BEAR LAKE, CA <br />
TELESCOP= 'SINGER' / <br />
WAVELNTH= 'HALPHA' / <br />
OBSERVER= 'XXX' / <br />
EXPTIME = 0.03000 / SECONDS <br />
TEC_TEMP= 0 / DEGREES C <br />
COMMENT ORIGIN FILE NAME h706l.fts <br />
ASP = 1.00000 / Raw image aspect ratio <br />
CENX = 1017 / Raw image disk center X <br />
CENY = 1018 / Raw image disk center Y <br />
MAXC = 6210 / Quiet Sun Max Brightness <br />
WIDT = 1771.00 / Width of disk (pixels) <br />
END <br />
<div>
<br /></div>
<div>
The header of a JPEG to FITS converted file:</div>
<div>
<br /></div>
<div>
<div class="MsoPlainText">
<span style="font-family: Courier New;"><span class="Apple-tab-span" style="white-space: pre;"> </span>SIMPLE = T</span></div>
<div class="MsoPlainText">
<span style="font-family: Courier New;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BITPIX = 8</span></div>
<div class="MsoPlainText">
<span style="font-family: Courier New;"><span class="Apple-tab-span" style="white-space: pre;"> </span>NAXIS = 2</span></div>
<div class="MsoPlainText">
<span style="font-family: Courier New;"><span class="Apple-tab-span" style="white-space: pre;"> </span>NAXIS1 = 2032</span></div>
<div class="MsoPlainText">
<span style="font-family: Courier New;"><span class="Apple-tab-span" style="white-space: pre;"> </span>NAXIS2 = 2032</span></div>
<div class="MsoPlainText">
<span style="font-family: Courier New;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BSCALE = 1.000000E+00</span></div>
<div class="MsoPlainText">
<span style="font-family: Courier New;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BZERO = 0.000000E+00</span></div>
<div class="MsoPlainText">
<span style="font-family: Courier New;"><span class="Apple-tab-span" style="white-space: pre;"> </span>DATAMAX = 2.550000E+02</span></div>
<div class="MsoPlainText">
<span style="font-family: Courier New;"><span class="Apple-tab-span" style="white-space: pre;"> </span>DATAMIN = 0.000000E+00</span><span style="font-family: 'Courier New';"> </span></div>
<div class="MsoPlainText">
<span style="font-family: 'Courier New';"> END</span></div>
</div>
<div>
<span style="font-family: 'Courier New';"><br /></span></div>
<div>
<br /></div>
<div>
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. </div>
<div>
<br /></div>
<div>
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. </div>
<div>
<div class="MsoPlainText">
<span style="font-family: "Courier New";"> <br />
<br />
<o:p> </o:p></span></div>
</div>
</div>
Sushant Mahajanhttp://www.blogger.com/profile/12958955029511994178noreply@blogger.com0tag:blogger.com,1999:blog-5901607420792365110.post-33111439517616016952015-06-25T18:18:00.001-04:002015-06-25T18:18:03.352-04:00JPEG files from 1997 to 2000<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
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.<br />
<br />
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.<br />
<br />
A simple terminal command can resize all images to 2032 X 2032:<br />
convert <filename> -resize 2032x2032 <newfilename><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<b> Example:</b><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Ho3DJ4B3Bd1G-IqqlaI4fBZioteEc1XO_NE81t1LSEsfhEtVshJTCFVjruiNngy5CcHz-byGGD6nFnI7XFbz2M42uNx_n90crWpCvAugAMBZJQD0JDp5-2ouN9DD0z7JvOpVIBdvVfNA/s1600/bbso_halph_fr_19990502_153322.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Ho3DJ4B3Bd1G-IqqlaI4fBZioteEc1XO_NE81t1LSEsfhEtVshJTCFVjruiNngy5CcHz-byGGD6nFnI7XFbz2M42uNx_n90crWpCvAugAMBZJQD0JDp5-2ouN9DD0z7JvOpVIBdvVfNA/s400/bbso_halph_fr_19990502_153322.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Original 1835 X 1835 image</td></tr>
</tbody></table>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmC8xqm-c0_Mmg94IjYisCDrASPEWpCkN4CTwfMjqKZYhMGFFe9G3x5wLoOwAF1bkxUBmteLRJ4g7c15x90ZzASaEFHZvEPI3vwWlBM3NXfEWTkcK6DVCOdiON6F7hixg8lid6eJjCJdGC/s1600/bbso_halph_fr_19990502_153322_rs.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmC8xqm-c0_Mmg94IjYisCDrASPEWpCkN4CTwfMjqKZYhMGFFe9G3x5wLoOwAF1bkxUBmteLRJ4g7c15x90ZzASaEFHZvEPI3vwWlBM3NXfEWTkcK6DVCOdiON6F7hixg8lid6eJjCJdGC/s400/bbso_halph_fr_19990502_153322_rs.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Resized 2032 X 2032 image</td></tr>
</tbody></table>
<br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyqjWa198uAyPFXtY0zuP9_iQBwx6pvAiTOtmq6d8SVASv7hd6N27mRrQos9oL58w2vemX4k0gmZJxrRVYYcNUHMHWiwjbK0W_DVKXuRssHXc7Ez8Brm88F11lq4HdckhBdWXor180BeNO/s1600/zoom_orig.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" height="396" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyqjWa198uAyPFXtY0zuP9_iQBwx6pvAiTOtmq6d8SVASv7hd6N27mRrQos9oL58w2vemX4k0gmZJxrRVYYcNUHMHWiwjbK0W_DVKXuRssHXc7Ez8Brm88F11lq4HdckhBdWXor180BeNO/s400/zoom_orig.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">A Solar filament in the original image</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR72NL6GOVwgOJMkZRplWtCByZV8Vjn_XURGZ45bfpdd1U5fp2v-IjVjlbELip5qTAbSWR5dYqsm8f5YkoCbRn-If2idue4BbPizBUs7Ek-Fa7nomsbHXcwgJ-EjrldYdQWPhywM6S5_XW/s1600/zoom_resized.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR72NL6GOVwgOJMkZRplWtCByZV8Vjn_XURGZ45bfpdd1U5fp2v-IjVjlbELip5qTAbSWR5dYqsm8f5YkoCbRn-If2idue4BbPizBUs7Ek-Fa7nomsbHXcwgJ-EjrldYdQWPhywM6S5_XW/s400/zoom_resized.JPG" width="398" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The same Solar filament in the resized image</td></tr>
</tbody></table>
<br /><div style="text-align: left;">
</div>
</div>
Sushant Mahajanhttp://www.blogger.com/profile/12958955029511994178noreply@blogger.com0tag:blogger.com,1999:blog-5901607420792365110.post-59142783432753713952015-06-25T17:55:00.001-04:002015-06-25T17:59:08.542-04:00Purpose of the Project<div dir="ltr" style="text-align: left;" trbidi="on">
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.<br />
<br />
<b>The problem:</b><br />
<br />
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.<br />
<br />
<br />
<b>Project:</b><br />
<br />
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.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZo5T_5QJIRpgqB9VSWmWS8saFrvKd7MLonepqYF3JQuECJ8Q4F-8Ha_i_YqO0ZBgA2plduIv5XTRneSiwpRiiDpjr6qxYuUOLxvYZH0mW9Vx3ywdEgqw1_5WcxUmKOXZ9_hhKXHdEmGm7/s1600/BBSO_database_survey.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="315" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZo5T_5QJIRpgqB9VSWmWS8saFrvKd7MLonepqYF3JQuECJ8Q4F-8Ha_i_YqO0ZBgA2plduIv5XTRneSiwpRiiDpjr6qxYuUOLxvYZH0mW9Vx3ywdEgqw1_5WcxUmKOXZ9_hhKXHdEmGm7/s640/BBSO_database_survey.JPG" width="640" /></a></div>
<br />
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.<br />
<br /></div>
Sushant Mahajanhttp://www.blogger.com/profile/12958955029511994178noreply@blogger.com0