Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple DMs #8

Open
brandondube opened this issue Aug 14, 2022 · 1 comment
Open

Multiple DMs #8

brandondube opened this issue Aug 14, 2022 · 1 comment

Comments

@brandondube
Copy link
Owner

For broad-band and/or two-sided ("full" or "round" dark hole) control, two DMs are required. The single DM Lyot Coronagraph model only has one. To support multiple DMs, both the Jacobian routines, and EFC need to know how to access multiple DMs.

@brandondube
Copy link
Owner Author

Thinking about this, the following statements are true:

  1. The user may want to only control some actuators on a DM surface. For example, a circular pupil inside a square DM has ~28% of DMs that are not visible.The wavefront control scales in the sense of actuators^3, so this 28% can massively reduce computation time (and memory needs).
  2. The writer of a class for a particular style of coronagraph knows how many DMs are in the model

Then the following seems reasonable:

  1. Classes can have pairs of c.dm1, c.dm1_mask the latter of which is a boolean array of that is truthy where we want to keep an actuator, and falsy where we want to ignore it. This pairing is purely conventional, and not visible to the consumers of the class.
  2. Instead of c.update_dm(dm1_acts) we do c.update_all_dms(concat_of_all_dms). The class is responsible for knowing how to unpack the array of all DM actuators (it looks something like this)
low = 0 
for dm, mask, active_nact in zip(dms, dm_masks, dm_nacts):
    dm.actuators[mask] =. concat_of_all_dms[low:low+active_nact]
    low += active_nact

This is scalable to arbitrary numbers of DMs, and because the broadcast of actuators to "DMs" is an internal detail, things that are not actually a DM, such as a focal plane mask, etc, can be treated this way. And because things are vectors and not intrinsically 2D, control via basis functions (etc) also works.

Since there is a way to set, there should also be a way to query all actuators, e.g. c.all_act_cmds() which packs them into a vector in the same way. This way EFC can initialize itself properly, and so on. Or we can write things in terms of a two-phase DM commanding strategy, where cmd0 is set one way, and ctrl_cmd is set another. The cmd0 formalism lets things like the command that flattens the static wavefront error be hidden away from EFC. It does make the implementation of each class slightly more complicated though, since there is more book-keeping and the loop sketched above would be cmds0[mask] + concat_...

Thoughts @Jashcraf ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant