AOtools / soapy

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

Running simulation #106

Closed CTugTEZ closed 4 years ago

CTugTEZ commented 4 years ago

When I try to start soapy I get an error:

In [1]: import soapy                                                                                                                                                                                        

In [2]: sim = soapy.Sim("conf/sh_8x8.yaml")                                                                                                                                                                 
Loading configuration file...
Pixel Scale: 12.50 pxls/m
subScreenSize: 102 simulation pixels
Loading configuration file... success!

In [3]: sim.aoinit()                                                                                                                                                                                        
Starting Sim: 2020-02-26-22-13-44
Pixel Scale: 12.50 pxls/m
subScreenSize: 102 simulation pixels
Creating mask...
Turbulence summary @ 500 nm:
| r0 = 0.16 m (0.64" seeing)
| Vbar_5/3 = 11.78 m/s
| tau0 = 4.26 ms
Initialise Infinite Phase Screen 1
Initialise Infinite Phase Screen 2
Initialise Infinite Phase Screen 3
Initialise Infinite Phase Screen 4
Initialising WFSs....
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.7/site-packages/soapy-v0.13.1_306_g3be7a0e-py3.7.egg/EGG-INFO/scripts/soapy in <module>
----> 1 sim.aoinit()

/usr/local/lib/python3.7/site-packages/soapy-v0.13.1_306_g3be7a0e-py3.7.egg/soapy/simulation.py in aoinit(self)
    200 
    201             self.wfss[nwfs] = wfsClass(
--> 202                     self.config, n_wfs=nwfs, mask=self.mask)
    203 
    204             self.config.wfss[nwfs].dataStart = self.config.sim.totalWfsData

/usr/local/lib/python3.7/site-packages/soapy-v0.13.1_306_g3be7a0e-py3.7.egg/soapy/wfs/base.py in __init__(self, soapy_config, n_wfs, mask)
    161 
    162         self.calcTiltCorrect()
--> 163         self.getStatic()
    164 
    165 ############################################################

/usr/local/lib/python3.7/site-packages/soapy-v0.13.1_306_g3be7a0e-py3.7.egg/soapy/wfs/shackhartmann.py in getStatic(self)
    299         phs = numpy.zeros([self.los.n_layers, self.screen_size, self.screen_size]).astype(DTYPE)
    300         self.staticData = self.frame(
--> 301                 phs, iMatFrame=True).copy().reshape(2, self.n_subaps)
    302 #######################################################################
    303 

/usr/local/lib/python3.7/site-packages/soapy-v0.13.1_306_g3be7a0e-py3.7.egg/soapy/wfs/base.py in frame(self, scrns, phase_correction, read, iMatFrame)
    437         if read:
    438             self.readDetectorPlane()
--> 439             self.calculateSlopes()
    440             self.zeroData(detector=False)
    441 

/usr/local/lib/python3.7/site-packages/soapy-v0.13.1_306_g3be7a0e-py3.7.egg/soapy/wfs/shackhartmann.py in calculateSlopes(self)
    427                 self.centSubapArrays, threads=self.threads)
    428 
--> 429         slopes = getattr(centroiders, self.config.centMethod)(
    430                 self.centSubapArrays,
    431                 threshold=self.config.centThreshold,

AttributeError: module 'aotools.image_processing.centroiders' has no attribute 'centre_of_gravity'

I have aotools: 0.5.2 soapy: v0.13.1-306-g3be7a0e Python 3.7.6

andrewpaulreeves commented 4 years ago

Hi @CTugTEZ !

The issue here is a recent change in the aotools to be more consistent. Upgrading to aotools 1.0 or higher should fix this.

Andrew

CTugTEZ commented 4 years ago

Thank you. Codes below fixed the issue. I write maybe someone can use: pip3 install aotools==1.0