Right now the matrices are calculated to work with an unknown number of DMs, in function create_singlewl_interaction_matrix in wfsc/wf_control_functions.py. To be applicable to all Testbed configurations and save time we separate the testbed in 3 parts:
The optics before the DM we want to actuate (these can be propagated through only once)
The DM we want to actuate (if not in pupil plane, the first Fresnel transform is calculated only once)
The optics after the DM we want to actuate (these have to be propagated through for each phase of the basis)
The first bullet point + the first Fresnel transform is only measured once and the last 2 are done once for each element of the basis. This is quite efficient (we only repeat what is absolutely necessary) but it is hard to parallelize because the function to parallelize (the last 2 bullet points) is tailored for each DM of each testbed.
In PR #135 I tried to make the function more compact (a few lines only), using the fact that we can define first and last bullet points mentioned above as sub-testbed. However, if those sub testbeds contains a DM (therefore not the currrent activated DM for this matrix), we cannot easily controled it so it might not be ideal in the case of several matrix calculation.
I kept the development in PR #135 in comment because they can be interesting for later, in function create_singlewl_interaction_matrix in wfsc/wf_control_functions.py.
Right now the matrices are calculated to work with an unknown number of DMs, in function create_singlewl_interaction_matrix in wfsc/wf_control_functions.py. To be applicable to all Testbed configurations and save time we separate the testbed in 3 parts:
The first bullet point + the first Fresnel transform is only measured once and the last 2 are done once for each element of the basis. This is quite efficient (we only repeat what is absolutely necessary) but it is hard to parallelize because the function to parallelize (the last 2 bullet points) is tailored for each DM of each testbed.
In PR #135 I tried to make the function more compact (a few lines only), using the fact that we can define first and last bullet points mentioned above as sub-testbed. However, if those sub testbeds contains a DM (therefore not the currrent activated DM for this matrix), we cannot easily controled it so it might not be ideal in the case of several matrix calculation.
I kept the development in PR #135 in comment because they can be interesting for later, in function create_singlewl_interaction_matrix in wfsc/wf_control_functions.py.