-
Notifications
You must be signed in to change notification settings - Fork 1
/
data_extract.m
54 lines (23 loc) · 855 Bytes
/
data_extract.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
spec = SalsaSpectrum('Observe-6/spectrum_12254.fits')
spec.fitBaseline([-240 -205 -140 -100 120 220],'vel',3)
spec.showBaseline()
spec.subtractBaseline()
spec.fitGaussians()
spec.fitGaussians([20.64 -1.6172 10],'dummy')
spec.plot()
spec.gaussParVel(2:3:end)
outfile = fopen('OUT.txt','a');
fittedvels = spec.gaussParVel(2:3:end);
% Read coordinates from FITS file
GLON = spec.getKeyword('CRVAL2');
GLAT = spec.getKeyword('CRVAL3');
% Write new line in outfile, starting with coordinates
fprintf(outfile,'%6.2f %6.2f',GLON, GLAT);
% Append, to this line, the fitted velocities
for i= 1:length(fittedvels)
fprintf(outfile,' %6.2f',fittedvels(i));
end
% End line with newline character, then proceed to next file
fprintf(outfile,'\n');
% Close outfile to flush all buffers.
fclose(outfile);