Commit 419a6379 authored by Daniel Brown's avatar Daniel Brown

Removing lower bound check on gouy puts. Fixing more tilt refractive index...

Removing lower bound check on gouy puts. Fixing more tilt refractive index issues for transfer functions
parent a96c52cb
......@@ -645,7 +645,9 @@ complex_t xyamp(node_t *sig_node, complex_t q) {
//warn("!!!! %g %g %s\n", nr, w0_size(q, nr), complex_form(q));
txs = z_by_x(q, w0);
// ddb - added in refractive index here to match up with
// diff comparison for tilt signals
txs = z_by_x(q, w0 / nr);
//printf("node: %s, q: %s, amp: %s (abs: %g angle %g)\n",sig_node.name,complex_form(q),complex_form(txs),zabs(txs), zdeg(txs));
return (txs);
}
......@@ -1396,12 +1398,12 @@ void fill_mirror_signal_rhs(signal_t *signal, ifo_matrix_vars_t* M_car, ifo_matr
double phase_r = f_sig->order * signal->phase; // amplitude modulated for alignment signals
double factor_r = signal->amplitude * EPSILON / 2; //Epsilon/2 for fsig
double factor_t = signal->amplitude * EPSILON / 4;
double factor_t = -signal->amplitude * EPSILON / 4;
// i factor for transmission is provided in the matrix multiplication
// a12f and a21f later
double phase_t = f_sig->order * signal->phase;
complex_t q1, q2;
complex_t q1 = complex_0, q2 = complex_0;
complex_t txs1 = complex_0, txs2 = complex_0;
// Compute coupling coefficients as in 4.6.2 Alignment transfer function
......@@ -1437,6 +1439,8 @@ void fill_mirror_signal_rhs(signal_t *signal, ifo_matrix_vars_t* M_car, ifo_matr
// compute q/w_0
txs2 = xyamp(node2, q2);
}
//warn("!!! %s nr1=%f nr2=%f\n", mirror->name, nr1, nr2 );
// the old Gouy phase problem again: I should now do a proper
// rev_gouy with txs1 and txs2, but I think it will just
......@@ -1454,7 +1458,7 @@ void fill_mirror_signal_rhs(signal_t *signal, ifo_matrix_vars_t* M_car, ifo_matr
// compute purely reflected and transmitted carrier field, do this by
// taking the incoming beam and computing the matrix multiplication
// with the reflection and transmissiong elements of the matrix. Store reflected field in
// with the reflection and transmission elements of the matrix. Store reflected field in
// memory already allocated for this in the signal structure
// In here will be the r, it, tuning factors for the generated sidebands
int ni, mi, nj, mj;
......@@ -1470,22 +1474,29 @@ void fill_mirror_signal_rhs(signal_t *signal, ifo_matrix_vars_t* M_car, ifo_matr
get_tem_modes_from_field_index(&nj, &mj, j);
if(!node1->gnd_node && include_mode_coupling(&mirror->a_cplng_11, ni,nj,mi,mj)) {
cidx = M_car->node_rhs_idx_1[node1->list_index] + get_node_rhs_idx(1, f_sig->carrier->index, j, M_car->num_frequencies);
# // Get the RHS index of port 1 of the node (The incoming port) then
// add to it the field HOM j at frequency f_sig->carrier->index.
cidx = M_car->node_rhs_idx_1[node1->list_index] + get_port_rhs_idx(f_sig->carrier->index, j);
// Apply component coupling matrix to the carrier field vector
signal->ar1[i] = z_pl_z(signal->ar1[i], z_by_z(*mirror->a11f[f_sig->carrier->index][f_sig->carrier->index][j][i], crhs[cidx]));
}
if(!node2->gnd_node && include_mode_coupling(&mirror->a_cplng_22, ni,nj,mi,mj)) {
cidx = M_car->node_rhs_idx_1[node2->list_index] + get_node_rhs_idx(2, f_sig->carrier->index, j, M_car->num_frequencies);
# // Get the RHS index of port 2 of the node (The incoming port) then
// add to it the field HOM j at frequency f_sig->carrier->index.
cidx = M_car->node_rhs_idx_2[node2->list_index] + get_port_rhs_idx(f_sig->carrier->index, j);
signal->ar2[i] = z_pl_z(signal->ar2[i], z_by_z(*mirror->a22f[f_sig->carrier->index][f_sig->carrier->index][j][i], crhs[cidx]));
}
// Similar to above but for transmitted carrier fields
if(!node1->gnd_node && !node2->gnd_node && include_mode_coupling(&mirror->a_cplng_12, ni,nj,mi,mj)) {
cidx = M_car->node_rhs_idx_1[node2->list_index] + get_node_rhs_idx(1, f_sig->carrier->index, j, M_car->num_frequencies);
cidx = M_car->node_rhs_idx_1[node1->list_index] + get_port_rhs_idx(f_sig->carrier->index, j);
signal->at2[i] = z_pl_z(signal->at2[i], z_by_z(*mirror->a12f[f_sig->carrier->index][f_sig->carrier->index][j][i], crhs[cidx]));
}
if(!node1->gnd_node && !node2->gnd_node && include_mode_coupling(&mirror->a_cplng_21, ni,nj,mi,mj)) {
cidx = M_car->node_rhs_idx_1[node2->list_index] + get_node_rhs_idx(2, f_sig->carrier->index, j, M_car->num_frequencies);
cidx = M_car->node_rhs_idx_2[node2->list_index] + get_port_rhs_idx(f_sig->carrier->index, j);
signal->at1[i] = z_pl_z(signal->at1[i], z_by_z(*mirror->a21f[f_sig->carrier->index][f_sig->carrier->index][j][i], crhs[cidx]));
}
}
......@@ -1507,6 +1518,10 @@ void fill_mirror_signal_rhs(signal_t *signal, ifo_matrix_vars_t* M_car, ifo_matr
// field is done in the carrier coupling coefficients
turn = 1.0;
//TODO: test and the finalize the above !
// ddb - update: Because we also deal with the transmitted field too
// which does have odd x modes reflected like reflection we have to
// apply this turning later specifically.
// the aim below is to select the carrier field index and from the carrier
// matrix extract the value to use in the signal field computation
......@@ -1539,6 +1554,7 @@ void fill_mirror_signal_rhs(signal_t *signal, ifo_matrix_vars_t* M_car, ifo_matr
if(!node1->gnd_node) a11 = z_pl_z(a11, z_by_x(z_by_z(signal->ar1[car_field], txs1), -1.0 * sqrt(tn + 1)));
if(!node2->gnd_node) a22 = z_pl_z(a22, z_by_x(z_by_z(signal->ar2[car_field], txs2), -1.0 * sqrt(tn + 1)));
if(!node1->gnd_node && !node2->gnd_node) {
a12 = z_pl_z(a12, z_by_x(z_by_z(signal->at2[car_field], txs2), -1.0 * sqrt(tn + 1)));
a21 = z_pl_z(a21, z_by_x(z_by_z(signal->at1[car_field], txs1), -1.0 * sqrt(tn + 1)));
......@@ -1556,22 +1572,25 @@ void fill_mirror_signal_rhs(signal_t *signal, ifo_matrix_vars_t* M_car, ifo_matr
}
if (!node1->gnd_node) {
sidx = M_sig->node_rhs_idx_1[node1->list_index] + get_node_rhs_idx(2, f, field_index, M_sig->num_frequencies);
srhs[sidx] = z_by_xph(a11, nr1 * turn * factor_r, phase_r);
// Get output at node 1
sidx = M_sig->node_rhs_idx_2[node1->list_index] + get_port_rhs_idx(f, field_index);
srhs[sidx] = z_by_xph(a11, turn * factor_r, phase_r);
if (!node2->gnd_node) {
z_inc_z(&srhs[sidx], z_by_xph(a21, (nr2-nr1)*factor_t, phase_t));
z_inc_z(&srhs[sidx], z_by_xph(a21, (nr1-nr2)*factor_t, phase_t));
if(zabs(a21) != 0) warn("!!! 21 %s %s %s\n", mirror->name, complex_form(a21), complex_form(srhs[sidx]));
}
// check if we need to conjugate the value for the lower sideband
if(f_sig->order == -1) srhs[sidx].im *= -1;
}
if (!node2->gnd_node) {
sidx = M_sig->node_rhs_idx_1[node2->list_index] + get_node_rhs_idx(1, f, field_index, M_sig->num_frequencies);
srhs[sidx] = z_by_xph(a22, nr2 * turn * factor_r, phase_r + ph2);
sidx = M_sig->node_rhs_idx_1[node2->list_index] + get_port_rhs_idx(f, field_index);
srhs[sidx] = z_by_xph(a22, turn * factor_r, phase_r + ph2);
if (!node1->gnd_node) {
z_inc_z(&srhs[sidx], z_by_xph(a12, (nr2-nr1)*factor_t, phase_t));
z_inc_z(&srhs[sidx], z_by_xph(a12, -(nr1-nr2)*factor_t, phase_t));
if(zabs(a12) != 0) warn("!!! 12 %s %s %s\n", mirror->name, complex_form(a12), complex_form(srhs[sidx]));
}
// check if we need to conjugate the value for the lower sideband
if(f_sig->order == -1) srhs[sidx].im *= -1;
......@@ -3489,10 +3508,10 @@ void compute_puts(void) {
x = *(inter.put_list[i].source);
}
if ((puttmp.lborder == 1 && x < puttmp.min)
|| (puttmp.uborder == 1 && x > puttmp.max) || (puttmp.lborder == 2
&& x <= puttmp.min)
|| (puttmp.uborder == 2 && x >= puttmp.max)) {
if ((puttmp.lborder == 1 && x < puttmp.min) ||
(puttmp.uborder == 1 && x > puttmp.max) ||
(puttmp.lborder == 2 && x <= puttmp.min)||
(puttmp.uborder == 2 && x >= puttmp.max)) {
gerror("put: parameter %s %s out of range\n", puttmp.component_name, puttmp.parameter_name);
}
......@@ -5034,7 +5053,7 @@ complex_t get_qshot_noise_spectral_density(
assert(detector_index >= 0);
assert(detector_index < inter.num_light_outputs);
complex_t noise_spectral_density;
complex_t noise_spectral_density = complex_0;
switch (light_output->demod_phase_mode[num_demod]) {
case MAX_PHASE:
......@@ -5048,6 +5067,7 @@ complex_t get_qshot_noise_spectral_density(
noise_spectral_density.im = 0;
break;
default:
bug_error("Unexpected phase demod value\n");
break;
}
......
......@@ -10741,16 +10741,16 @@ int assign_space_parameter(component_param_t *component_param) {
*component_param->xparam = &(space->gouy_x);
//inter.space_list[component_param->component_index].rebuild=0;
strcpy(component_param->unit, " [rad]");
*component_param->lborder = 1;
*component_param->lborder = 0;
*component_param->uborder = 0;
*component_param->min = 0.0;
*component_param->min = 0;
} else if (strcasecmp("phiy", component_param->parameter) == 0 ||
strcasecmp("gouyy", component_param->parameter) == 0 ||
strcasecmp("gy", component_param->parameter) == 0) {
*component_param->xparam = &(space->gouy_y);
//inter.space_list[component_param->component_index].rebuild=0;
strcpy(component_param->unit, " [rad]");
*component_param->lborder = 1;
*component_param->lborder = 0;
*component_param->uborder = 0;
*component_param->min = 0.0;
} else if (strcasecmp("L", component_param->parameter) == 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