AOtools / soapy

A Python Adaptive Optics Simulation
GNU General Public License v3.0
85 stars 32 forks source link

Cannot generate DM shape image #123

Open shiqi1994 opened 2 years ago

shiqi1994 commented 2 years ago

Firstly, I would like to thank you for your great work!!

I have some trouble in generating multiple frames of DM shape images, here is my code:

import soapy

sim = soapy.Sim("conf/vicky.yaml")
sim.aoinit()
sim.makeIMat()
sim.aoloop()

soapy_config = sim.config

circle_mask = soapy.simulation.make_mask(soapy_config)
dm_cmds = sim.allDmCommands 
dmClass = soapy.DM.DM(soapy_config, n_dm=0, mask=circle_mask)
dmFrame = dmClass.dmFrame(dm_cmds)

And the warning massage is:

Traceback (most recent call last):

  File "/home/vicky/soapy/untitled3.py", line 24, in <module>
    dmFrame = dmClass.dmFrame(dm_cmds)

  File "/home/vicky/soapy/soapy/DM.py", line 164, in dmFrame
    self.dm_shape = self.makeDMFrame(dmCommands)

  File "/home/vicky/soapy/soapy/DM.py", line 200, in makeDMFrame
    dm_shape = (self.iMatShapes.T*actCoeffs.T).T.sum(0)

ValueError: operands could not be broadcast together with shapes (9,) (81,6) 

And the configuration about DM is:

DM:
  0:
    type: FastPiezo
    closed: False
    nxActuators: 9
    iMatValue: 500

May I ask how can I generate DM shape images?

And what the exact meaning of the nxActuators ?

Look forward to your kind replay! Thank you very much!