AOtools / soapy

A Python Adaptive Optics Simulation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading phase screens from .fits

moniquecockram opened this issue · comments

I am currently trying to load a phase screen from a fits file (one that was saved from a previous run of a simulation) into my simulation (a simple WFS, no DM). However, the WFS frames that are generated do not change over time.
This issue also occurs when getting the simulation to generate phase screens itself.

Something to note which might be helpful context: To do both of these things, my understanding is that the atmosphere parameter infinite must be set to False (and was done so when the above issues are occurring). However, when testing by setting infinite to True, the WFS frames do change over time.

Could you please provide any assistance in successfully loading a phase screen from a fits file?

Thank you for your help!

Hi @moniquecockram!

Thanks for flagging this! I have just done a quick test using the sh_8x8.yaml config file and I have been unable to replicate it. I can save the screens using sim.atmos.saveScrns() then set the scrnNames parameter in the config file to a list of the file names of the screens, and they are loaded up on the next time and everything works, I get the same slopes output. You have to set both infinite and randomScrns to False otherwise the sim will just generate new screens.

Could you post the config file you are using? At least the atmosphere part. Thanks!

Hi @ojdf ,

Thank you for your reply! Sorry for the delay in a response, I was on leave.

I have just re-run the simulation and re-saved the phase screens. I was then able to load these successfully into my simulation. So I am not sure what went wrong last week, or if there was ever anything wrong with my config file. The only thing I added was randomScrns: False to the config file, even though this is default anyway. See below, for your reference (it is very similar to sh_8x8.yaml):

Atmosphere:
  scrnNames: [scrn0.fits, scrn1.fits, scrn2.fits, scrn3.fits]
  scrnNo: 4
  scrnHeights: [0, 5000, 10000, 15000]
  scrnStrengths: [0.5, 0.3, 0.1, 0.1]
  windDirs: [0, 45, 90, 135]
  windSpeeds: [10, 10, 15, 20]
  wholeScrnSize: 2048
  r0: 0.1
  L0: [20, 20, 20, 20]
  infinite: False
  randomScrns: False

I was also having errors occur for a while today with saveScrns() but those were also (magically) resolved.

Just to note, I found that restarting the kernel I was running the code in did not solve the problem, which often can be the case. It really is a mystery.

Thank you for your help, and for your time in solving what was apparently a 'me' issue, although any further tips are welcome!

Hi @moniquecockram, glad it seems to be fixed! I will close this now but please get in touch if anything else does not work as expected