forked from sgarrettroe/data_analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess2d.m
99 lines (89 loc) · 2.65 KB
/
process2d.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
function s = process2d(s, number, varargin)
% process2d will process the data and make a plot.
% This should be enough for 90% of all needs
%
% INPUT:
% - s (struct): the 2d-struct with all data
%
% - number (number): will be used as a number for the figure
%
% OPTIONAL INPUT, for details, see the functions they refer to.
% - apodization (name): will apply apodization in absorptive2d. Default is
% 'none'.
% - apod_nr ([a b]): factors for some of the apodization functions in
% absorptive2d. Default is [10 10], which works for 'rbOnes' and
% 'rbGauss'.
% - debug (BOOL): will write some stuff, handy for debugging :)
% - fft_type (name): determines the type of fft in absorptive2d. Default is
% 'sgrsfft'.
% - n_contours (number): number of contours plotted by rb2dPlot. Default is
% 12.
% - zlimit (number): how much of the z-axis is plotted by rb2dPlot. Default
% is 0 (all).
% - no_units (BOOL): will print the indices instead of frequencies in
% rb2dPlot. Handy for finding broken pixels etc. Default is false.
apodization = 'none';
flag_debug = false;
fft_type = 'sgrsfft';
n_contours = 12;
zlimit = 0;
no_units = false;
apod_nr = [-0.5 3];
line_width = 1;
xlim = [0 0];
ylim = [0 -1];
while length(varargin) >= 2
arg = varargin{1};
val = varargin{2};
switch lower(arg)
case 'apodization'
apodization = val;
case 'apod_nr'
apod_nr = val;
case 'xlim'
xlim = val;
case 'ylim'
ylim = val;
case 'debug'
flag_debug = val;
case 'fft_type'
fft_type = val;
case 'n_contours'
n_contours = val;
case 'zlimit'
zlimit = val;
case 'no_units'
no_units = val;
case 'line_width'
line_width = val;
otherwise
error(['process2d: unknown option ', arg]);
end
varargin = varargin(3:end);
end
if flag_debug; disp(['process2d: flag_debug:' int2str(flag_debug)]); end
s = absorptive2d(s,...
'phase', s.phase,...
'zeropad', s.zeropad,...
'range', [s.freq(1), s.freq(end)],...
'fft_type', fft_type,...
'apodization', apodization,...
'apod_numbers', apod_nr,...
'debug', flag_debug,...
'plot', flag_debug);
title_string = ({strcat(int2str(s.date),...
': ', s.basename,...
', T2: ', num2str(s.t2),...
', ts:', num2str(s.time_stamp),...
', scans x shots:', num2str(s.n_scan), ' x ', num2str(s.n_shots)),...
s.comment});
figure(number),clf
rb2dPlot(s,...
'n_contours', n_contours,...
'zlimit', zlimit,...
'title', title_string,...
'no_units', no_units,...
'debug', flag_debug,...
'line_width', line_width,...
'xlim', xlim,...
'ylim', ylim);