AOtools / soapy

A Python Adaptive Optics Simulation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

time.clock() function is removed after Python 3.7

alexisyslau opened this issue · comments

Hi,

time.clock() function is removed. Would you mind looking into this issue?

Hi @alexisyslau - this is interesting. The only place i can find this is in the pyqtgraph sub-module. Could you post the trace-back from where its gone wrong? I can certainly update the packaged version of pyqtgraph though, which should hopefully fix it

c:\users\jretoreynal\anaconda3\lib\site-packages\soapy-198d33e870f6e22b0d66a14b53d4627cf7e07d01-py3.9.egg\EGG-INFO\scripts\soapy:16: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Loading configuration file...
Pixel Scale: 12.50 pxls/m
subScreenSize: 102 simulation pixels
Loading configuration file... success!
Traceback (most recent call last):
File "C:\Users\jretoreynal\Anaconda3\Scripts\soapy", line 4, in
import('pkg_resources').run_script('soapy===198d33e870f6e22b0d66a14b53d4627cf7e07d01', 'soapy')
File "C:\Users\jretoreynal\Anaconda3\lib\site-packages\pkg_resources_init_.py", line 662, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "C:\Users\jretoreynal\Anaconda3\lib\site-packages\pkg_resources_init_.py", line 1459, in run_script
exec(code, namespace, namespace)
File "c:\users\jretoreynal\anaconda3\lib\site-packages\soapy-198d33e870f6e22b0d66a14b53d4627cf7e07d01-py3.9.egg\EGG-INFO\scripts\soapy", line 119, in
from soapy import gui
File "C:\Users\jretoreynal\Anaconda3\lib\site-packages\soapy-198d33e870f6e22b0d66a14b53d4627cf7e07d01-py3.9.egg\soapy\gui_init_.py", line 1, in
from .gui import GUI, start_gui
File "C:\Users\jretoreynal\Anaconda3\lib\site-packages\soapy-198d33e870f6e22b0d66a14b53d4627cf7e07d01-py3.9.egg\soapy\gui\gui.py", line 60, in
from .. import pyqtgraph
File "C:\Users\jretoreynal\Anaconda3\lib\site-packages\soapy-198d33e870f6e22b0d66a14b53d4627cf7e07d01-py3.9.egg\soapy\pyqtgraph_init_.py", line 204, in
from .graphicsItems.VTickGroup import *
File "C:\Users\jretoreynal\Anaconda3\lib\site-packages\soapy-198d33e870f6e22b0d66a14b53d4627cf7e07d01-py3.9.egg\soapy\pyqtgraph\graphicsItems\VTickGroup.py", line 7, in
from .. import functions as fn
File "C:\Users\jretoreynal\Anaconda3\lib\site-packages\soapy-198d33e870f6e22b0d66a14b53d4627cf7e07d01-py3.9.egg\soapy\pyqtgraph\functions.py", line 17, in
from . import debug
File "C:\Users\jretoreynal\Anaconda3\lib\site-packages\soapy-198d33e870f6e22b0d66a14b53d4627cf7e07d01-py3.9.egg\soapy\pyqtgraph\debug.py", line 11, in
from . import ptime
File "C:\Users\jretoreynal\Anaconda3\lib\site-packages\soapy-198d33e870f6e22b0d66a14b53d4627cf7e07d01-py3.9.egg\soapy\pyqtgraph\ptime.py", line 24, in
cstart = systime.clock() ### Required to start the clock in windows
AttributeError: module 'time' has no attribute 'clock'

Just in case this is useful for anybody else (probably this is not the place and sorry about that in advance):
Soapy – Installation Tutorial for Windows 64 bits (I would suggest to create a new python environment..):

  1. Install Anaconda3-5.1.0-Windows-x86_64.exe --> link: https://repo.anaconda.com/archive/Anaconda3-5.1.0-Windows-x86_64.exe

  2. Open a terminal

  3. conda install pyyaml

  4. pip install pyfftw

  5. conda install numba

  6. conda install –c aotools aotools

  7. Go to the soapy directory in the terminal

  8. python setup.py install

  9. conda install numpy==1.15

How to run soapy:

  1. open a cmd

  2. cd C:\Users...\soapy-master\conf. --> (... := complete the path)

  3. soapy –g placeholder.yaml

  4. example for 3: soapy –g sh_8x8.yaml

On a macbook the installation process was really straight forward!

Thanks very much @juanretoreynal10 for this workaround, I'm wondering if we can just replace the ptime.py in the pyqtgraph shipped with soapy and it will fix this in the short term. I don't have a windows machine to test on at the moment. Could you try a fresh install of my fork (https://github.com/ojdf/soapy/tree/ptime-fix, specifically the ptime-fix branch) and see if it is fixed on windows?