Commit 86c0c3c4 authored by Daniel Brown's avatar Daniel Brown

Fixes to astigmatic lens component. Now has lens** and lens*** for astigmatic...

Fixes to astigmatic lens component. Now has lens** and lens*** for astigmatic focal and power definitions
parent 2bf32224
......@@ -1047,7 +1047,7 @@ int main(int argc, char *argv[]) {
inter.num_motion_eqns += alloc_bs_motions(bs, inter.num_signal_freqs);
}
}
// check whether we should automatically retrace
if (inter.rebuild & 2 && !inter.retrace_manual) {
inter.retrace = 1;
......
......@@ -1480,7 +1480,6 @@ int set_k_mirror(int mirror_index) {
case 2: //bayer-helms
if (!(integrating & 1)) {
// TODO: This computes the bayer-helms coefficients or it analytically computes
// them using the old integration routine. Ideally, later once the rest
// has been tested, this will be moved over to use the Cuba library. Especially
......@@ -4615,39 +4614,30 @@ void set_ABCD_lens(int lens_index) {
}
// if focal length=0, ignore lens
double fx = lens->fx_of_Dx;
double X = lens->fx_of_Dx;
// if we're dealing with optical power, invert it
if (!lens->is_focal_length) {
fx = 1.0 / fx;
}
if (fx == 0.0) {
X = 1.0 / X;
} else if (X == 0.0) {
warn("focal length is zero, lens '%s' ignored\n", lens->name);
fx = -1.0e23;
X = -1.0e23;
}
if (NOT node1->gnd_node && NOT node2->gnd_node) {
lens->qx = make_ABCD(1.0, 0.0, -1 / fx, 1.0);
lens->qx = make_ABCD(1.0, 0.0, -1 / X, 1.0);
}
if(lens->is_astigmatic){
// if focal length=0, ignore lens
double fy = lens->fy_of_Dy;
double Y = lens->fy_of_Dy;
// if we're dealing with optical power, invert it
if (!lens->is_focal_length) {
fy = 1.0 / fy;
}
if (fy == 0.0) {
warn("focal length (y) is zero, lens '%s' ignored\n", lens->name);
fy = -1.0e23;
}
if (!lens->is_focal_length) {
Y = 1.0 / Y;
} else if (Y == 0.0) {
warn("focal length is zero, lens '%s' ignored\n", lens->name);
Y = -1.0e23;
}
if (NOT node1->gnd_node && NOT node2->gnd_node) {
lens->qy = make_ABCD(1.0, 0.0, -1 / fy, 1.0);
}
if (NOT node1->gnd_node && NOT node2->gnd_node) {
lens->qy = make_ABCD(1.0, 0.0, -1 / Y, 1.0);
}
}
......@@ -5860,12 +5850,11 @@ int component_matrix(ABCD_t *matrix, int component_index,
if (node1_index == node2_index) {
return (1);
}
if (tan_sag == TANGENTIAL) {
if (tan_sag == TANGENTIAL)
*matrix = (lens->qx);
} else {
else
*matrix = (lens->qy);
}
printf("!! %f %f %f %f\n", matrix->A, matrix->B, matrix->C, matrix->D);
break;
case DIODE:
diode = &(inter.diode_list[component_index]);
......
......@@ -4575,6 +4575,7 @@ void tune_parameters(void) {
* \see Test_rebuild_all()
*/
void rebuild_all(void) {
//int tid = startTimer("REBUILD_ALL");
int _tid;
......
......@@ -2987,6 +2987,7 @@ void read_lens(const char *command_string, bool using_diopters, bool astigmatic)
} else {
lens->is_focal_length = true;
lens->fx_of_Dx = fx_or_Dx;
lens->fy_of_Dy = fy_or_Dy;
}
}
......@@ -3002,7 +3003,7 @@ void read_lens(const char *command_string, bool using_diopters, bool astigmatic)
lens->fy_of_Dy = fy_or_Dy;
}
} else {
if (atod(focal_x_power_string, &fy_or_Dy)) {
if (atod(focal_y_power_string, &fy_or_Dy)) {
gerror("Line `%s':\nUnable to read the focal length value\n",
command_string);
} else {
......@@ -3011,7 +3012,7 @@ void read_lens(const char *command_string, bool using_diopters, bool astigmatic)
}
}
}
// grab the node indices
lens->node1_index = update_node_index_for(node1_name, IN_OUT);
lens->node2_index = update_node_index_for(node2_name, OUT_IN);
......
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