david-hoffman / dphtools

Tools for optics and image analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

module 'dphtools.display' has no attributes 'psf_plot' and 'otf_plot'

gleb-shtengel opened this issue · comments

Trying to run your Phase Retrieval Tutorial notebook. It has a cell:

import dphtools.display as dplt
from pyotf.utils import easy_fft
for d in (PSFi, PR_result.generate_zd_psf()):
dplt.psf_plot(d, 1.27, 1.33, 1.33, zstep=model_kwargs["zres"], pixel_size=model_kwargs["res"], norm=mpl.colors.PowerNorm(0.5), interpolation="bicubic")
otf = abs(easy_fft(d))
dplt.otf_plot(otf / otf.max(), 1.27, 0.525, 1.33, 1.33, model_kwargs["zres"], model_kwargs["res"], vmin=1e-3)

Trying to execute it generates the error:

AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_18960/2343569178.py in
2 from pyotf.utils import easy_fft
3 for d in (PSFi, PR_result.generate_zd_psf()):
----> 4 dplt.psf_plot(d, 1.27, 1.33, 1.33, zstep=model_kwargs["zres"], pixel_size=model_kwargs["res"], norm=mpl.colors.PowerNorm(0.5), interpolation="bicubic")
5 otf = abs(easy_fft(d))
6 dplt.otf_plot(otf / otf.max(), 1.27, 0.525, 1.33, 1.33, model_kwargs["zres"], model_kwargs["res"], vmin=1e-3)

AttributeError: module 'dphtools.display' has no attribute 'psf_plot'

If I try to run just a part of it:
otf = abs(easy_fft(d))
dplt.otf_plot(otf / otf.max(), 1.27, 0.525, 1.33, 1.33, model_kwargs["zres"], model_kwargs["res"], vmin=1e-3)

I get a similar error: AttributeError: module 'dphtools.display' has no attribute 'otf_plot'

I have you latest dphtools v.0.0.2 installed.

Thank you!

Try uninstalling v0.0.2 and installing directly from GitHub via

pip intall git+https://github.com/david-hoffman/dphtools.git@main

That should work, I need to increase the version.

I tried both:

C:\Users\labadmin> pip install git+https://github.com/david-hoffman/dphtools.git@main
Collecting git+https://github.com/david-hoffman/dphtools.git@main
Cloning https://github.com/david-hoffman/dphtools.git (to revision main) to c:\users\labadmin\appdata\local\temp\pip-req-build-9y6e3oha
Running command git clone -q https://github.com/david-hoffman/dphtools.git 'C:\Users\labadmin\AppData\Local\Temp\pip-req-build-9y6e3oha'
ERROR: Error [WinError 2] The system cannot find the file specified while executing command git clone -q https://github.com/david-hoffman/dphtools.git 'C:\Users\labadmin\AppData\Local\Temp\pip-req-build-9y6e3oha'
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

and
C:\Users\labadmin> pip install git+https://github.com/david-hoffman/dphtools.git@f9f19ef5b0a00169562947c78a41c1f02e222a6a
Collecting git+https://github.com/david-hoffman/dphtools.git@f9f19ef5b0a00169562947c78a41c1f02e222a6a
Cloning https://github.com/david-hoffman/dphtools.git (to revision f9f19ef) to c:\users\labadmin\appdata\local\temp\pip-req-build-wdkjwpjr
Running command git clone -q https://github.com/david-hoffman/dphtools.git 'C:\Users\labadmin\AppData\Local\Temp\pip-req-build-wdkjwpjr'
ERROR: Error [WinError 2] The system cannot find the file specified while executing command git clone -q https://github.com/david-hoffman/dphtools.git 'C:\Users\labadmin\AppData\Local\Temp\pip-req-build-wdkjwpjr'
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

Seems to be not working. I would appreciate any suggestions as to what I might be doing wrong.
Thanks!