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.
Saturday 3 October 2015
Complete Procedure 1.0
STEP1: RESIZE to 2032x2032
In the folder where you have all the original JPEG images:
for file in *.jpg; do convert $file -resize 2032x2032 resized_$file; done
STEP2: CONVERT to .fits files
a. Move the resized JPEGS to a new folder and convert them to .fits files:
for file in *.jpg; do convert $file $file.fits; done
b. Create a list of the resized_ filenames for the next step:
ls | grep -i "resized" > filenames.txt
STEP3: Extract the TIME, DATE, Solar disk CENTER(X,Y) and disk RADIUS from resized JPEG images in MATLAB
<date_time_circles.m>
[names]=strcolread('filenames.txt',153,42);
% 153= # of files
% 42= length of the string of each filename
% (including a return at the end of each filename)
yy=names(:,23:26); % Year
mm=names(:,27:28); % Month
dd=names(:,29:30); % Day
hh=names(:,32:33); % Hours
min=names(:,34:35); % Minutes
ss=names(:,36:37); % Seconds
for n=1:153
timeobs(n,:)=[hh(n,:),':',min(n,:),':',ss(n,:)];
dateobs(n,:)=[yy(n,:),'-',mm(n,:),'-',dd(n,:)];
date_obs(n,:)=[yy(n,:),'-',mm(n,:),'-',dd(n,:),'T',hh(n,:),':',min(n,:),':',ss(n,:),'.000Z'];
end
data=horzcat(timeobs,dateobs,date_obs);
dlmwrite('date_time.txt',data,'delimiter','');
% Extracting the Center of the Solar Disk and its radius:
for n=1:153
[centers(n,:), radii(n), metric(n)] = imfindcircles(imread(sprintf(names(n,1:end-1))), [950 1000], ...
'Sensitivity',0.9900,'EdgeThreshold',0.01,'Method','TwoStage','ObjectPolarity', 'Bright');
end
centers(:,3)=radii';
centers2=round(centers);
fileid=fopen('circle_info.txt','w')
for n=1:153
fprintf(fileid,'%d %d %d\n',centers2(n,1),centers2(n,2),centers2(n,3));
end
fclose(fileid);
This routine will take hours to run for more than 150 files.
Move the new files <date_time.txt> and <circle_info.txt> to the folder containing the converted .fits files
<date_time.txt> should have a single column of stings joined together.
STEP4: Appending the header
a. Create a list of all file names for .fits files:
ls | grep -i "fits" > filenames.txt
b. Move the file <edit_header.py> to the directory containing all .fits files, <filenames.txt>, <date_time.txt> and <circle_info.txt>.
c. Change the number of filenames in the Python code to be equal to the entries you have in <filenames.txt>
d. Open a terminal and type:
chmod +x edit_header.py
./edit_header.py
And watch magic happen, the headers of all .fits files are changed!
In the folder where you have all the original JPEG images:
for file in *.jpg; do convert $file -resize 2032x2032 resized_$file; done
STEP2: CONVERT to .fits files
a. Move the resized JPEGS to a new folder and convert them to .fits files:
for file in *.jpg; do convert $file $file.fits; done
b. Create a list of the resized_ filenames for the next step:
ls | grep -i "resized" > filenames.txt
STEP3: Extract the TIME, DATE, Solar disk CENTER(X,Y) and disk RADIUS from resized JPEG images in MATLAB
<date_time_circles.m>
[names]=strcolread('filenames.txt',153,42);
% 153= # of files
% 42= length of the string of each filename
% (including a return at the end of each filename)
yy=names(:,23:26); % Year
mm=names(:,27:28); % Month
dd=names(:,29:30); % Day
hh=names(:,32:33); % Hours
min=names(:,34:35); % Minutes
ss=names(:,36:37); % Seconds
for n=1:153
timeobs(n,:)=[hh(n,:),':',min(n,:),':',ss(n,:)];
dateobs(n,:)=[yy(n,:),'-',mm(n,:),'-',dd(n,:)];
date_obs(n,:)=[yy(n,:),'-',mm(n,:),'-',dd(n,:),'T',hh(n,:),':',min(n,:),':',ss(n,:),'.000Z'];
end
data=horzcat(timeobs,dateobs,date_obs);
dlmwrite('date_time.txt',data,'delimiter','');
% Extracting the Center of the Solar Disk and its radius:
for n=1:153
[centers(n,:), radii(n), metric(n)] = imfindcircles(imread(sprintf(names(n,1:end-1))), [950 1000], ...
'Sensitivity',0.9900,'EdgeThreshold',0.01,'Method','TwoStage','ObjectPolarity', 'Bright');
end
centers(:,3)=radii';
centers2=round(centers);
fileid=fopen('circle_info.txt','w')
for n=1:153
fprintf(fileid,'%d %d %d\n',centers2(n,1),centers2(n,2),centers2(n,3));
end
fclose(fileid);
This routine will take hours to run for more than 150 files.
Move the new files <date_time.txt> and <circle_info.txt> to the folder containing the converted .fits files
<date_time.txt> should have a single column of stings joined together.
STEP4: Appending the header
a. Create a list of all file names for .fits files:
ls | grep -i "fits" > filenames.txt
b. Move the file <edit_header.py> to the directory containing all .fits files, <filenames.txt>, <date_time.txt> and <circle_info.txt>.
c. Change the number of filenames in the Python code to be equal to the entries you have in <filenames.txt>
d. Open a terminal and type:
chmod +x edit_header.py
./edit_header.py
And watch magic happen, the headers of all .fits files are changed!
Thursday 1 October 2015
Known and Unknown parameters
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:
OBJECT='SUN'
TYPE-OBS='FULLDISK'
SEEING=0 / I don't think this matters for the analysis
CDELT1=1.05440 / This quantity is the same for all images
CDELT2=1.05440 /
CTYPE1='ARCSEC'
CTYPE2='ARCSEC'
CRVAL1=0 / I don't really know what this means, but it is always 0
CRVAL2=0
ORIGIN='BBSO'
TELESCOPE='SINGER'
WAVELNTH='HALPHA'
OBSERVER='X'
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.
TEC_TEMP=0 / There is no way to extract this from the images
ASP=1.00000 / Raw image aspect ratio
The remaining parameters listed below can be extracted from the converted images:
# By analysis of the solar disk, detecting its center and radius:
CRPIX1= / Central pixel in X
CRPIX2= / Central pixel in Y
CENX= / Raw image disk center X
CENY= / Raw image disk center Y
WIDT= / Width of the disk (pixels)
MAXC= / Quiet Sun Max Brightness (probably won't be able to extract this)
# From the filename:
TIME-OBS='hh:mm:ss' / From the filename
DATE-OBS='yyy-mm-dd' / From filename
DATE_OBS='yyy-mm-ddThh:mm:ss.000Z' /
Now, the job is to actually extract these parameters and write them in the filename headers.
OBJECT='SUN'
TYPE-OBS='FULLDISK'
SEEING=0 / I don't think this matters for the analysis
CDELT1=1.05440 / This quantity is the same for all images
CDELT2=1.05440 /
CTYPE1='ARCSEC'
CTYPE2='ARCSEC'
CRVAL1=0 / I don't really know what this means, but it is always 0
CRVAL2=0
ORIGIN='BBSO'
TELESCOPE='SINGER'
WAVELNTH='HALPHA'
OBSERVER='X'
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.
TEC_TEMP=0 / There is no way to extract this from the images
ASP=1.00000 / Raw image aspect ratio
The remaining parameters listed below can be extracted from the converted images:
# By analysis of the solar disk, detecting its center and radius:
CRPIX1= / Central pixel in X
CRPIX2= / Central pixel in Y
CENX= / Raw image disk center X
CENY= / Raw image disk center Y
WIDT= / Width of the disk (pixels)
MAXC= / Quiet Sun Max Brightness (probably won't be able to extract this)
# From the filename:
TIME-OBS='hh:mm:ss' / From the filename
DATE-OBS='yyy-mm-dd' / From filename
DATE_OBS='yyy-mm-ddThh:mm:ss.000Z' /
Now, the job is to actually extract these parameters and write them in the filename headers.
Subscribe to:
Posts (Atom)