UltraScan III
us_vhw_enhanced.h
Go to the documentation of this file.
1 #ifndef US_VHW_ENHCD_H
2 #define US_VHW_ENHCD_H
3 
4 #include "us_dataIO.h"
5 #include "us_analysis_base2.h"
6 #include "us_distrib_plot.h"
7 #include "us_editor.h"
8 #include "us_math2.h"
9 #include "us_model.h"
10 #include "us_run_details2.h"
11 #include "us_buffer_gui.h"
12 #include "qwt_plot_marker.h"
13 
14 #define PA_POINTS 20 // plateau average points to left and right
15 
16 #ifndef DbgLv
17 #define DbgLv(a) if(dbg_level>=a)qDebug()
18 #endif
19 
20 typedef struct groupinfo_s
21 {
22  double x1; // x of top mouse pick
23  double y1; // y of top mouse pick
24  double x2; // x of bottom mouse pick
25  double y2; // y of bottom mouse pick
26  double sed; // average intercept sedcoeff of group
27  double percent; // percent fraction of all divisions
28  int ndivs; // number of division lines included in pick
29  QList< int > idivs; // list of divisions (0 to n-1) included
30 } GrpInfo;
31 
33 {
34  Q_OBJECT
35 
36  public:
38 
39  private:
40 
41  enum { NONE, START, END } groupstep;
42 
43  QLabel* lb_tolerance;
44  QLabel* lb_division;
45 
46  QLineEdit* le_temper;
47  QLineEdit* le_model;
48 
49  QCheckBox* ck_modelpl;
50  QCheckBox* ck_vhw_enh;
51  QCheckBox* ck_manrepl;
52  QCheckBox* ck_use_fed;
53 
55 
56  QwtCounter* ct_tolerance;
57  QwtCounter* ct_division;
58 
59  QwtPlotCurve* curve;
60  QwtPlotCurve* dcurve;
62 
63  QPushButton* pb_dstrpl;
64  QPushButton* pb_rsetda;
65  QPushButton* pb_selegr;
66  QPushButton* pb_replot;
67 
68  double boundPct;
69  double positPct;
70  double baseline;
71  double correc;
72  double C0;
73  double c0term;
74  double Swavg;
75  double omega;
76  double range;
77  double span;
78  double basecut;
79  double platcut;
80  double bdtoler;
81  double invert;
82  double divfac;
83  double cpij;
84  double sumcpij;
85  double sedc;
86  double sdiff;
87  double bdiff_coef;
88  double bdiff_sedc;
89  double total_conc;
90 
91  int row;
92  int run_id;
93  int divsCount;
94  int scanCount;
96  int dbg_level;
97  int lscnCount;
98 
99  bool haveZone;
100  bool groupSel;
101  bool forcePlot;
102  bool skipPlot;
103  bool mo_plats;
104  bool vhw_enh;
105 
106  QString run_name;
107  QString cell;
108  QString wavelength;
109  QString workingDir;
110  QString runID;
111  QString editID;
112 
113  QVector< US_DataIO::EditedData > dsimList; // Simulation data
114  QVector< bool > have_sims; // Have-simulation flags
115  QVector< US_Model > modlList; // Models for triples
116 
117  QVector< double > aseds; // All division sedcoeff values
118  QVector< double > dseds; // Division sedcoeff intercepts
119  QVector< double > dslos; // Division slope values
120  QVector< double > dsigs; // Division sigma values
121  QVector< double > dcors; // Division correlation values
122  QVector< int > dpnts; // Division fitted line points
123 
124  QVector< double > scPlats; // Scan plateaus current triple
125  QVector< int > liveScans; // Vector of live-scan indexes
126  QVector< bool > saved; // List by triple of saved flags
127  QVector< QVector< double > > CPijs; // CPij vecs, divs in scans
128  QVector< QVector< double > > mconcs; // Mid-div concs, divs in scans
129  QVector< double > bdrads; // Back-diffusion radii
130  QVector< double > bdcons; // Back-diffusion concentrations
131 
132  QList< double > groupxy; // Group select pick coordinates
133  QList< GrpInfo > groupdat; // Selected group info structures
134 
135  US_DataIO::EditedData* edata; // Current triple edited data
136  US_DataIO::EditedData* expda; // Current triple edited data (exp.)
137  US_DataIO::EditedData* simda; // Current triple edited data (sim.)
138  US_DataIO::Scan* dscan; // Current data scsan
139  US_DataIO::Scan* expsc; // Current data scsan (exp.)
140  US_DataIO::Scan* simsc; // Current data scsan (sim.)
141 
142  US_Model model; // Current loaded model
143 
144  int kcalls[20]; // Timing counts
145  int kmsecs[20];
146  private slots:
147 
148  void load( void );
149  void data_plot( void );
150  void distr_plot( void );
151  void save_data( void );
152  void view_report( void );
153  void sel_groups( void );
154  void div_seds( void );
155  void update_density( double );
156  void update_viscosity( double );
157  void update_vbar( double );
158  void update_bdtoler( double );
159  void update_divis( double );
160  int first_gteq( double, QVector< double >&, int, int );
161  int first_gteq( double, QVector< double >&, int );
162  double sed_coeff( double, double, double* = NULL, int* = NULL );
163  double avg_plateau( void );
164  double find_root( double );
165  double sedcoeff_intercept( void );
166  double back_diff_coeff( double );
167  void groupClick( const QwtDoublePoint& );
168  void add_group_info( void );
169  void write_vhw( void );
170  void write_dis( void );
171  void write_model( void );
172  void write_report( QTextStream& );
173  QString text_time( double, int );
174  QString text_time( double );
175  QStringList last_edit_files( QStringList );
176  void new_triple ( int );
177  void update ( int );
178  void copy_data_files( QString, QString, QString );
179  bool fitted_plateaus( void );
180  bool model_plateaus ( void );
181  void plot_refresh ( void );
182  void vhw_calcs_enhanced( double*, double* );
183  void vhw_calcs_standard( double*, double* );
184  bool have_model ( void );
185  void vert_exclude_lines ( void );
186  void exclude_from ( double );
187  void exclude_to ( double );
188  void live_scans ( void );
189  void init_partials ( void );
190  void update_mid_concs ( void );
191  void create_simulation ( void );
192  void plot_data2 ( void );
193  void get_model ( void );
194 
195  void help ( void )
196  { showHelp.show_help( "vhw_enhanced.html" ); };
197 
198 };
199 #endif