Commit 11bdf6e8 authored by Daniel Brown's avatar Daniel Brown

Switching off signal calculation when doing locks, speeds up some simulations...

Switching off signal calculation when doing locks, speeds up some simulations significantly as the signal matrix output is never used for DC lockin
parent 2ee700f8
...@@ -288,7 +288,7 @@ void compute_data(void) { ...@@ -288,7 +288,7 @@ void compute_data(void) {
update_fields = true; update_fields = true;
tune_parameters(); tune_parameters();
data_point_new(); data_point_new(true);
if (inter.debug & 8192) { if (inter.debug & 8192) {
//dump_matrix(STANDARD, "stdout"); //dump_matrix(STANDARD, "stdout");
...@@ -754,7 +754,7 @@ void _fill_dioptre_mod_knn(signal_t *signal, double Px, double Py, node_t* nodes ...@@ -754,7 +754,7 @@ void _fill_dioptre_mod_knn(signal_t *signal, double Px, double Py, node_t* nodes
double phase = f_sig->order * signal->phase; double phase = f_sig->order * signal->phase;
double factor = signal->amplitude * EPSILON * 0.5; //Epsilon/2 for fsig double factor = signal->amplitude * EPSILON * 0.5; //Epsilon/2 for fsig
for(i=0; i<4; i++){ for(i=0; i<1; i++){
node_t *node_from = nodes_options[i][0]; node_t *node_from = nodes_options[i][0];
node_t *node_to = nodes_options[i][1]; node_t *node_to = nodes_options[i][1];
...@@ -2038,7 +2038,7 @@ int x_count = 0; ...@@ -2038,7 +2038,7 @@ int x_count = 0;
* This differs from the old data_point routine which handles frequencies * This differs from the old data_point routine which handles frequencies
* sequentially instead of solving all frequencies at the same time. * sequentially instead of solving all frequencies at the same time.
*/ */
void data_point_new(){ void data_point_new(int do_sig){
//int tid = startTimer("DATAPOINT"); //int tid = startTimer("DATAPOINT");
// ensure that the fsig variables are always sensible // ensure that the fsig variables are always sensible
...@@ -2076,7 +2076,7 @@ void data_point_new(){ ...@@ -2076,7 +2076,7 @@ void data_point_new(){
factor_matrix(STANDARD); factor_matrix(STANDARD);
clear_rhs(STANDARD); clear_rhs(STANDARD);
int using_sig_qcorr = inter.num_signal_freqs > 0; int using_sig_qcorr = inter.num_signal_freqs > 0 && do_sig;
if(using_sig_qcorr){ if(using_sig_qcorr){
// clear the rhs vector as we will add to it in the next loop for the laser frequency modulation... // clear the rhs vector as we will add to it in the next loop for the laser frequency modulation...
...@@ -3748,7 +3748,7 @@ double fn_minimizer(double x) { ...@@ -3748,7 +3748,7 @@ double fn_minimizer(double x) {
compute_puts(); compute_puts();
rebuild_all(); rebuild_all();
data_point_new(); data_point_new(true);
fill_detectors(); fill_detectors();
//-------------------------------- //--------------------------------
...@@ -3860,7 +3860,7 @@ void tune_parameters(void) { ...@@ -3860,7 +3860,7 @@ void tune_parameters(void) {
set_progress_action_text("Calculating"); set_progress_action_text("Calculating");
print_progress(init.num_points_total, current_point_tot); // print progress percents print_progress(init.num_points_total, current_point_tot); // print progress percents
data_point_new(); data_point_new(false);
fill_detectors(); fill_detectors();
// compute_functions(); // compute_functions();
...@@ -3915,6 +3915,9 @@ void tune_parameters(void) { ...@@ -3915,6 +3915,9 @@ void tune_parameters(void) {
counter++; counter++;
subcounter++; subcounter++;
} }
data_point_new(true);
fill_detectors();
inter.startlock++; inter.startlock++;
if (inter.startlock > 1 && init.sequential & 4) { if (inter.startlock > 1 && init.sequential & 4) {
...@@ -3972,7 +3975,7 @@ void tune_parameters(void) { ...@@ -3972,7 +3975,7 @@ void tune_parameters(void) {
compute_puts(); compute_puts();
rebuild_all(); rebuild_all();
data_point_new(); data_point_new(true);
fill_detectors(); fill_detectors();
} }
...@@ -4232,7 +4235,7 @@ void write_data_header(FILE *ofp) { ...@@ -4232,7 +4235,7 @@ void write_data_header(FILE *ofp) {
void x0_out(void) { void x0_out(void) {
// set parameters from command // set parameters from command
data_point_new(); data_point_new(true);
fill_detectors(); fill_detectors();
......
...@@ -78,7 +78,7 @@ void create_data_array(complex_t *sol); ...@@ -78,7 +78,7 @@ void create_data_array(complex_t *sol);
void compute_result(complex_t *z_tmp); void compute_result(complex_t *z_tmp);
complex_t xyamp(node_t *sig_node, complex_t q); complex_t xyamp(node_t *sig_node, complex_t q);
void data_point_new(void); void data_point_new(int);
void fill_detectors(void); void fill_detectors(void);
complex_t beam_shape(int detector_index); complex_t beam_shape(int detector_index);
......
...@@ -677,22 +677,21 @@ void read_file(FILE *fp) { ...@@ -677,22 +677,21 @@ void read_file(FILE *fp) {
insert_constants_values(s); insert_constants_values(s);
if (strncasecmp(s, "fsig ", 4) == 0) { if (strncasecmp(s, "fsig ", 4) == 0) {
read_fsig(s); read_fsig(s);
} }
else if (strncasecmp(s, "gnuplot", 7) == 0) { else if (strncasecmp(s, "gnuplot", 7) == 0) {
read_init_dummy(fp, 0); read_init_dummy(fp, 0);
} }
else if (strncasecmp(s, "python", 6) == 0) { else if (strncasecmp(s, "python", 6) == 0) {
read_init_dummy(fp, 0); read_init_dummy(fp, 0);
} }
else if (strncasecmp(s, "matlabplot", 10) == 0) { else if (strncasecmp(s, "matlabplot", 10) == 0) {
read_init_dummy(fp, 0); read_init_dummy(fp, 0);
} }
else if (strncasecmp(s, "matlab", 6) == 0) { else if (strncasecmp(s, "matlab", 6) == 0) {
read_init_dummy(fp, 0); read_init_dummy(fp, 0);
} }
else if (strncasecmp(s, "shot ", 5) == 0) { else if (strncasecmp(s, "shot ", 5) == 0) {
// if (!inter.beam.set) // ignoring other detetcors if beam analyser is set!
read_shot(s); read_shot(s);
} else if (strncasecmp(s, "qshot ", 6) == 0 } else if (strncasecmp(s, "qshot ", 6) == 0
|| strncasecmp(s, "qshotS ", 7) == 0 || strncasecmp(s, "qshotS ", 7) == 0
...@@ -1674,7 +1673,11 @@ void read_mirror(const char *command_string, int mode) { ...@@ -1674,7 +1673,11 @@ void read_mirror(const char *command_string, int mode) {
// set the transmissivity, reflectivity and loss of the mirror // set the transmissivity, reflectivity and loss of the mirror
mirror->T = transmittance; mirror->T = transmittance;
mirror->R = 1.0 - mirror->T - loss; mirror->R = 1.0 - mirror->T - loss;
assert(mirror->R >= 0.0); // check to make sure the reflectivity >= 0
if(mirror->R < 0.0 && fabs(mirror->R) > 1e-15){ // check to make sure the reflectivity >= 0
gerror("Mirror %s has a reflectivity %g, which should be zero.", mirror->name, mirror->R);
}
// reset the reflectivity as is done in read_beamsplitter() // reset the reflectivity as is done in read_beamsplitter()
if (mirror->R < 0.0) { if (mirror->R < 0.0) {
mirror->R = 0.0; mirror->R = 0.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment