Skip to content

Add pre-commit And poetry For Demonstration#3

Closed
O957 wants to merge 260 commits intoxiaziyna:mainfrom
O957:attempt-use-poetry-and-pre-commit
Closed

Add pre-commit And poetry For Demonstration#3
O957 wants to merge 260 commits intoxiaziyna:mainfrom
O957:attempt-use-poetry-and-pre-commit

Conversation

@O957
Copy link

@O957 O957 commented Dec 11, 2024

This PR covers adding poetry and pre-commit to PyStarshade for @xiaziyna to determine their utility.

@O957
Copy link
Author

O957 commented Dec 11, 2024

By default, I have, for ruff, "--ignore=E741", "--ignore=E731".

I am flagging below there are decent number of ruff issues:

  • E402 Module level import not at top of file
  • F841 Local variable bit_x is assigned to but never used
  • E711 Comparison to None should be cond is None
  • F821 Undefined name four_chunked_zoom_fft
  • F601 Dictionary key literal "dist_ss_t" repeated
  • F405 FresnelSingle may be undefined, or defined from star imports

For now, I am going to ignore all of them. If the author of PyStarshade wants to un-ignore them at some point in the future, fixing them so pre-commit runs successfully, this is their choice.

@O957
Copy link
Author

O957 commented Dec 11, 2024

In settings, one can creation a Branch protection for main that makes it required for status checks to pass before a PR can be merged.

@O957
Copy link
Author

O957 commented Dec 11, 2024

Updated Workflow:

Clone the repository:

git clone https://github.com/xiaziyna/PyStarshade.git
cd PyStarshade

Install dependencies using Poetry:

poetry install

(Optional) If you need to work with pre-computed data, use Git LFS to pull the necessary files:

git lfs pull

Activate the virtual environment created by Poetry:

poetry shell

@O957
Copy link
Author

O957 commented Dec 11, 2024

This PR is about ready for review.

Idea: Close with comment and then re-open once you better desire and or understand what is occurring with pre-commit and poetry.

Hope this helps and or is interesting, @xiaziyna; any comments are appreciated!

@O957
Copy link
Author

O957 commented Dec 11, 2024

Actually, one more thing. Here is the original output from running pre-commit run --all-files the first time:

Details
AFg6K7h4fhy2@Trevors-MacBook-Air PyStarshade % pre-commit install
pre-commit installed at .git/hooks/pre-commit
AFg6K7h4fhy2@Trevors-MacBook-Air PyStarshade % pre-commit run --all-files
check for added large files..............................................Passed
check python ast.........................................................Failed
- hook id: check-ast
- exit code: 1

tests/test_circle.py: failed parsing with CPython 3.12.5:

    Traceback (most recent call last):
      File "/Users/AFg6K7h4fhy2/.cache/pre-commit/reporx39rhbl/py_env-python3.12/lib/python3.12/site-packages/pre_commit_hooks/check_ast.py", line 21, in main
        ast.parse(f.read(), filename=filename)
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ast.py", line 52, in parse
        return compile(source, filename, mode, flags,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "tests/test_circle.py", line 9
        from from pystarshade.apodization.apodize import *
             ^^^^
    SyntaxError: invalid syntax

check for case conflicts.................................................Passed
check docstring is first.................................................Passed
check yaml...............................................................Passed
check toml...........................................(no files to check)Skipped
fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing docs/content/usage.rst
Fixing pystarshade/data/masks/grey_mask.py
Fixing pystarshade/__init__.py
Fixing setup.py
Fixing docs/index.rst
Fixing pystarshade/apodization/__init__.py
Fixing pystarshade/diffraction/__init__.py

mixed line ending........................................................Passed
python tests naming......................................................Passed
pretty format json...................................(no files to check)Skipped
trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing docs/content/usage.rst
Fixing pystarshade/propagator.py
Fixing pystarshade/diffraction/util.py
Fixing pystarshade/data/masks/mp_gen_mask.py
Fixing docs/content/test.rst
Fixing pystarshade/diffraction/bluestein_fft.py
Fixing pystarshade/data/masks/README
Fixing tests/test_chunk_fft.py
Fixing examples/visualize_throughput.py
Fixing docs/index.rst
Fixing pystarshade/diffraction/field.py
Fixing README.md
Fixing examples/exovista_sim.py
Fixing tests/test_circle.py
Fixing pystarshade/apodization/apodize.py
Fixing pystarshade/data/drm.py
Fixing tests/test_bluestein_fft.py
Fixing docs/paper/paper.md
Fixing pystarshade/diffraction/diffract.py
Fixing pystarshade/data/masks/make_memmap.py
Fixing pystarshade/simulate_field.py

check that executables have shebangs.................(no files to check)Skipped
detect private key.......................................................Passed
black....................................................................Failed
- hook id: black
- exit code: 123
- files were modified by this hook

reformatted docs/conf.py
reformatted examples/simple_point_source.py
reformatted examples/download_exovista.py
reformatted examples/star_exo.py
reformatted pystarshade/data/masks/grey_mask.py
reformatted pystarshade/apodization/pupil.py
reformatted pystarshade/data/masks/make_memmap.py
reformatted pystarshade/data/drm.py
reformatted examples/exovista_sim.py
reformatted pystarshade/data/masks/mp_gen_mask.py
reformatted pystarshade/apodization/apodize.py
reformatted setup.py
reformatted examples/visualize_throughput.py
reformatted pystarshade/diffraction/field.py
error: cannot format tests/test_circle.py: Cannot parse: 9:5: from from pystarshade.apodization.apodize import *
reformatted pystarshade/diffraction/util.py
reformatted tests/test_chunk_fft.py
reformatted pystarshade/simulate_field.py
reformatted pystarshade/diffraction/diffract.py
reformatted pystarshade/propagator.py
reformatted tests/test_bluestein_fft.py
reformatted pystarshade/diffraction/bluestein_fft.py

Oh no! 💥 💔 💥
21 files reformatted, 13 files left unchanged, 1 file failed to reformat.

isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/docs/conf.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/examples/exovista_sim.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/examples/simple_point_source.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/examples/star_exo.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/examples/visualize_throughput.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/apodization/apodize.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/apodization/pupil.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/data/masks/grey_mask.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/data/masks/mp_gen_mask.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/diffraction/bluestein_fft.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/diffraction/diffract.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/diffraction/field.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/diffraction/util.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/propagator.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/pystarshade/simulate_field.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/setup.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/tests/test_bluestein_fft.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/tests/test_chunk_fft.py
Fixing /Users/AFg6K7h4fhy2/Documents/GitHub/Repositories/PyStarshade/tests/test_circle.py

ruff.....................................................................Failed
- hook id: ruff
- exit code: 1
- files were modified by this hook

docs/conf.py:17:1: E402 Module level import not at top of file
   |
15 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
16 | 
17 | import os
   | ^^^^^^^^^ E402
18 | 
19 | # paths from conf.py
   |

docs/conf.py:20:1: E402 Module level import not at top of file
   |
19 | # paths from conf.py
20 | import sys
   | ^^^^^^^^^^ E402
21 | 
22 | sys.path.insert(
   |

examples/exovista_sim.py:15:1: E402 Module level import not at top of file
   |
14 | download_exovista.exovista_scenes_file()
15 | import os
   | ^^^^^^^^^ E402
16 | 
17 | import matplotlib.pyplot as plt
   |

examples/exovista_sim.py:17:1: E402 Module level import not at top of file
   |
15 | import os
16 | 
17 | import matplotlib.pyplot as plt
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E402
18 | from matplotlib.colors import LogNorm
   |

examples/exovista_sim.py:18:1: E402 Module level import not at top of file
   |
17 | import matplotlib.pyplot as plt
18 | from matplotlib.colors import LogNorm
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E402
19 | 
20 | from pystarshade.data.scenes.Scene import *
   |

examples/exovista_sim.py:20:1: E402 Module level import not at top of file
   |
18 | from matplotlib.colors import LogNorm
19 | 
20 | from pystarshade.data.scenes.Scene import *
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E402
21 | from pystarshade.diffraction.util import (
22 |     au_to_meter,
   |

examples/exovista_sim.py:20:1: F403 `from pystarshade.data.scenes.Scene import *` used; unable to detect undefined names
   |
18 | from matplotlib.colors import LogNorm
19 | 
20 | from pystarshade.data.scenes.Scene import *
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
21 | from pystarshade.diffraction.util import (
22 |     au_to_meter,
   |

examples/exovista_sim.py:21:1: E402 Module level import not at top of file
   |
20 |   from pystarshade.data.scenes.Scene import *
21 | / from pystarshade.diffraction.util import (
22 | |     au_to_meter,
23 | |     data_file_path,
24 | |     mas_to_rad,
25 | |     pc_to_meter,
26 | | )
   | |_^ E402
27 |   from pystarshade.propagator import StarshadeProp
   |

examples/exovista_sim.py:27:1: E402 Module level import not at top of file
   |
25 |     pc_to_meter,
26 | )
27 | from pystarshade.propagator import StarshadeProp
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E402
28 | 
29 | fname = "1215-HIP_16537-TYC_-mv_3.72-L_0.35-d_3.20-Teff_5048.07.fits"
   |

examples/exovista_sim.py:39:9: F405 `Scene` may be undefined, or defined from star imports
   |
38 | t = 0  # timestep
39 | scene = Scene(file_path)
   |         ^^^^^ F405
40 | bg_scene = scene.getDiskImage()
41 | star_xy = scene.getXYstar()
   |

examples/exovista_sim.py:55:10: F405 `np` may be undefined, or defined from star imports
   |
54 | N_wl = len(wl_range)
55 | N_dust = np.shape(bg_scene)[1]
   |          ^^ F405
56 | N_dust_half = N_dust // 2
   |

examples/exovista_sim.py:59:18: F405 `np` may be undefined, or defined from star imports
   |
58 | N_s = 1001
59 | extended_field = np.zeros((N_wl, N_s, N_s), dtype=np.complex128)
   |                  ^^ F405
60 | half_N = N_s // 2
61 | half_in_N = N_dust // 2
   |

examples/exovista_sim.py:59:51: F405 `np` may be undefined, or defined from star imports
   |
58 | N_s = 1001
59 | extended_field = np.zeros((N_wl, N_s, N_s), dtype=np.complex128)
   |                                                   ^^ F405
60 | half_N = N_s // 2
61 | half_in_N = N_dust // 2
   |

examples/exovista_sim.py:71:8: F405 `np` may be undefined, or defined from star imports
   |
69 | n_planet = 0
70 | for i in range(1, scene.nplanets):
71 |     if np.all(planet_xy[i] - N_dust_half + half_N <= N_s - 1) and np.all(
   |        ^^ F405
72 |         planet_xy[i] - N_dust_half + half_N >= 0
73 |     ):
   |

examples/exovista_sim.py:71:67: F405 `np` may be undefined, or defined from star imports
   |
69 | n_planet = 0
70 | for i in range(1, scene.nplanets):
71 |     if np.all(planet_xy[i] - N_dust_half + half_N <= N_s - 1) and np.all(
   |                                                                   ^^ F405
72 |         planet_xy[i] - N_dust_half + half_N >= 0
73 |     ):
   |

examples/exovista_sim.py:95:7: F405 `np` may be undefined, or defined from star imports
   |
93 |     "Semi major axis[au]: ",
94 |     ds_au
95 |     * np.hypot(planet_xy[1:, 0] - N_dust_half, planet_xy[1:, 1] - N_dust_half),
   |       ^^ F405
96 | )
97 | print("wavelength [m]", wl)
   |

examples/exovista_sim.py:110:37: F405 `np` may be undefined, or defined from star imports
    |
108 | hwo_starshade.gen_psf_basis(pupil_type=pupil_type, pupil_symmetry=True)
109 | focal_intensity = hwo_starshade.gen_scene(
110 |     pupil_type, source_field.astype(np.float32), 500e-9, pupil_symmetry=True
    |                                     ^^ F405
111 | )
    |

examples/exovista_sim.py:122:1: F405 `np` may be undefined, or defined from star imports
    |
120 | )
121 | print(save_path)
122 | np.savez_compressed(save_path, field=focal_intensity)
    | ^^ F405
    |

examples/simple_point_source.py:6:14: F821 Undefined name `np`
  |
4 | hwo_starshade.gen_pupil_field()
5 | hwo_starshade.gen_psf_basis("hex")
6 | test_field = np.zeros((1001, 1001))
  |              ^^ F821
7 | test_field[500, 500] = 1e11
8 | test_field[800, 760] = 1
  |

examples/simple_point_source.py:10:1: F821 Undefined name `np`
   |
 8 | test_field[800, 760] = 1
 9 | out = hwo_starshade.gen_scene("hex", test_field, 500e-9)
10 | np.savez_compressed("test_field.npz", field=out)
   | ^^ F821
   |

examples/visualize_throughput.py:24:48: F821 Undefined name `fname`
   |
22 |     os.path.join(script_dir, "..", "pystarshade", "data")
23 | )
24 | file_path_on = os.path.join(data_dir, "pupil", fname)
   |                                                ^^^^^ F821
25 | file_path_off = os.path.join(data_dir, "pupil", fname)
   |

examples/visualize_throughput.py:25:49: F821 Undefined name `fname`
   |
23 | )
24 | file_path_on = os.path.join(data_dir, "pupil", fname)
25 | file_path_off = os.path.join(data_dir, "pupil", fname)
   |                                                 ^^^^^ F821
26 | 
27 | data = np.load(file_path_on)
   |

pystarshade/apodization/pupil.py:2:1: F403 `from hcipy import *` used; unable to detect undefined names
  |
1 | import numpy as np
2 | from hcipy import *
  | ^^^^^^^^^^^^^^^^^^^ F403
  |

pystarshade/apodization/pupil.py:13:12: F405 `make_hexagonal_segmented_aperture` may be undefined, or defined from star imports
   |
11 |         pupil_diameter - (2 * num_rings + 1) * gap_size
12 |     ) / (2 * num_rings + 1)
13 |     return make_hexagonal_segmented_aperture(
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F405
14 |         num_rings, segment_flat_to_flat, gap_size
15 |     )
   |

pystarshade/apodization/pupil.py:19:13: F405 `make_circular_aperture` may be undefined, or defined from star imports
   |
18 | aperture_funcs = {
19 |     "circ": make_circular_aperture,
   |             ^^^^^^^^^^^^^^^^^^^^^^ F405
20 |     "ELT": make_elt_aperture,
21 |     "GMT": make_gmt_aperture,
   |

pystarshade/apodization/pupil.py:20:12: F405 `make_elt_aperture` may be undefined, or defined from star imports
   |
18 | aperture_funcs = {
19 |     "circ": make_circular_aperture,
20 |     "ELT": make_elt_aperture,
   |            ^^^^^^^^^^^^^^^^^ F405
21 |     "GMT": make_gmt_aperture,
22 |     "TMT": make_tmt_aperture,
   |

pystarshade/apodization/pupil.py:21:12: F405 `make_gmt_aperture` may be undefined, or defined from star imports
   |
19 |     "circ": make_circular_aperture,
20 |     "ELT": make_elt_aperture,
21 |     "GMT": make_gmt_aperture,
   |            ^^^^^^^^^^^^^^^^^ F405
22 |     "TMT": make_tmt_aperture,
23 |     "Hale": make_hale_aperture,
   |

pystarshade/apodization/pupil.py:22:12: F405 `make_tmt_aperture` may be undefined, or defined from star imports
   |
20 |     "ELT": make_elt_aperture,
21 |     "GMT": make_gmt_aperture,
22 |     "TMT": make_tmt_aperture,
   |            ^^^^^^^^^^^^^^^^^ F405
23 |     "Hale": make_hale_aperture,
24 |     "LUVOIR-A": make_luvoir_a_aperture,
   |

pystarshade/apodization/pupil.py:23:13: F405 `make_hale_aperture` may be undefined, or defined from star imports
   |
21 |     "GMT": make_gmt_aperture,
22 |     "TMT": make_tmt_aperture,
23 |     "Hale": make_hale_aperture,
   |             ^^^^^^^^^^^^^^^^^^ F405
24 |     "LUVOIR-A": make_luvoir_a_aperture,
25 |     "LUVOIR-B": make_luvoir_b_aperture,
   |

pystarshade/apodization/pupil.py:24:17: F405 `make_luvoir_a_aperture` may be undefined, or defined from star imports
   |
22 |     "TMT": make_tmt_aperture,
23 |     "Hale": make_hale_aperture,
24 |     "LUVOIR-A": make_luvoir_a_aperture,
   |                 ^^^^^^^^^^^^^^^^^^^^^^ F405
25 |     "LUVOIR-B": make_luvoir_b_aperture,
26 |     "Magellan": make_magellan_aperture,
   |

pystarshade/apodization/pupil.py:25:17: F405 `make_luvoir_b_aperture` may be undefined, or defined from star imports
   |
23 |     "Hale": make_hale_aperture,
24 |     "LUVOIR-A": make_luvoir_a_aperture,
25 |     "LUVOIR-B": make_luvoir_b_aperture,
   |                 ^^^^^^^^^^^^^^^^^^^^^^ F405
26 |     "Magellan": make_magellan_aperture,
27 |     "VLT": make_vlt_aperture,
   |

pystarshade/apodization/pupil.py:26:17: F405 `make_magellan_aperture` may be undefined, or defined from star imports
   |
24 |     "LUVOIR-A": make_luvoir_a_aperture,
25 |     "LUVOIR-B": make_luvoir_b_aperture,
26 |     "Magellan": make_magellan_aperture,
   |                 ^^^^^^^^^^^^^^^^^^^^^^ F405
27 |     "VLT": make_vlt_aperture,
28 |     "HiCAT": make_hicat_aperture,
   |

pystarshade/apodization/pupil.py:27:12: F405 `make_vlt_aperture` may be undefined, or defined from star imports
   |
25 |     "LUVOIR-B": make_luvoir_b_aperture,
26 |     "Magellan": make_magellan_aperture,
27 |     "VLT": make_vlt_aperture,
   |            ^^^^^^^^^^^^^^^^^ F405
28 |     "HiCAT": make_hicat_aperture,
29 |     "HabEx": make_habex_aperture,
   |

pystarshade/apodization/pupil.py:28:14: F405 `make_hicat_aperture` may be undefined, or defined from star imports
   |
26 |     "Magellan": make_magellan_aperture,
27 |     "VLT": make_vlt_aperture,
28 |     "HiCAT": make_hicat_aperture,
   |              ^^^^^^^^^^^^^^^^^^^ F405
29 |     "HabEx": make_habex_aperture,
30 |     "HST": make_hst_aperture,
   |

pystarshade/apodization/pupil.py:29:14: F405 `make_habex_aperture` may be undefined, or defined from star imports
   |
27 |     "VLT": make_vlt_aperture,
28 |     "HiCAT": make_hicat_aperture,
29 |     "HabEx": make_habex_aperture,
   |              ^^^^^^^^^^^^^^^^^^^ F405
30 |     "HST": make_hst_aperture,
31 |     "JWST": make_jwst_aperture,
   |

pystarshade/apodization/pupil.py:30:12: F405 `make_hst_aperture` may be undefined, or defined from star imports
   |
28 |     "HiCAT": make_hicat_aperture,
29 |     "HabEx": make_habex_aperture,
30 |     "HST": make_hst_aperture,
   |            ^^^^^^^^^^^^^^^^^ F405
31 |     "JWST": make_jwst_aperture,
32 |     "Keck": make_keck_aperture,
   |

pystarshade/apodization/pupil.py:31:13: F405 `make_jwst_aperture` may be undefined, or defined from star imports
   |
29 |     "HabEx": make_habex_aperture,
30 |     "HST": make_hst_aperture,
31 |     "JWST": make_jwst_aperture,
   |             ^^^^^^^^^^^^^^^^^^ F405
32 |     "Keck": make_keck_aperture,
33 |     "hex": custom_hex,
   |

pystarshade/apodization/pupil.py:32:13: F405 `make_keck_aperture` may be undefined, or defined from star imports
   |
30 |     "HST": make_hst_aperture,
31 |     "JWST": make_jwst_aperture,
32 |     "Keck": make_keck_aperture,
   |             ^^^^^^^^^^^^^^^^^^ F405
33 |     "hex": custom_hex,
34 | }
   |

pystarshade/apodization/pupil.py:63:18: F405 `make_pupil_grid` may be undefined, or defined from star imports
   |
61 |     - The pupil data is reshaped into a 2D array of size `(N_t, N_t)` before saving.
62 |     """
63 |     pupil_grid = make_pupil_grid(N_t)
   |                  ^^^^^^^^^^^^^^^ F405
64 |     pupil = evaluate_supersampled(
65 |         call_aperture_function(pupil_type, normalized=True), pupil_grid, 8
   |

pystarshade/apodization/pupil.py:64:13: F405 `evaluate_supersampled` may be undefined, or defined from star imports
   |
62 |     """
63 |     pupil_grid = make_pupil_grid(N_t)
64 |     pupil = evaluate_supersampled(
   |             ^^^^^^^^^^^^^^^^^^^^^ F405
65 |         call_aperture_function(pupil_type, normalized=True), pupil_grid, 8
66 |     )
   |

pystarshade/data/drm.py:21:9: F601 Dictionary key literal `"dist_ss_t"` repeated
   |
19 |         "dx_": [0.01, 0.005, 0.002, 0.001, 0.0005],
20 |         "wl_bands": wfirst_wl_bands,
21 |         "dist_ss_t": 3.724225668350351e07
   |         ^^^^^^^^^^^ F601
22 |         * np.sum(wfirst_wl_bands[0])
23 |         / np.sum(wfirst_wl_bands, axis=1),
   |
   = help: Remove repeated key literal `"dist_ss_t"`

pystarshade/data/masks/mp_gen_mask.py:104:13: F821 Undefined name `convolve`
    |
103 | mask = mask.astype(np.float64)
104 | grey_mask = convolve(mask, np.ones((up_sample, up_sample)))[
    |             ^^^^^^^^ F821
105 |     ::up_sample, ::up_sample
106 | ].astype(np.float64)
    |

pystarshade/data/masks/mp_gen_mask.py:109:43: F821 Undefined name `final_dx_str`
    |
107 | grey_mask /= up_sample**2
108 | np.savez_compressed(
109 |     "starshade_masks/grey_hwo_24_mask_" + final_dx_str + "m_qu.npz",
    |                                           ^^^^^^^^^^^^ F821
110 |     grey_mask=grey_mask,
111 | )
    |

pystarshade/diffraction/bluestein_fft.py:44:5: F841 Local variable `bit_x` is assigned to but never used
   |
42 |     N_chirp = N_x + N_out - 1
43 | 
44 |     bit_x = N_x % 2
   |     ^^^^^ F841
45 |     bit_chirp = N_chirp % 2
46 |     bit_out = N_out % 2
   |
   = help: Remove assignment to unused variable `bit_x`

pystarshade/diffraction/bluestein_fft.py:425:5: F841 Local variable `bit_x` is assigned to but never used
    |
423 | def single_chunked_zoom_fft_mod(x, N_x, N_out, N_X, i=0):
424 |     # For computing the FFT over a single input chunk i = 0...3, and deciding which one
425 |     bit_x = N_x % 2
    |     ^^^^^ F841
426 |     sec_N_x = (
427 |         N_x // 2 + 1
    |
    = help: Remove assignment to unused variable `bit_x`

pystarshade/diffraction/diffract.py:8:1: F403 `from pystarshade.diffraction.util import *` used; unable to detect undefined names
  |
6 |     zoom_fft_2d_mod,
7 | )
8 | from pystarshade.diffraction.util import *
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
  |

pystarshade/diffraction/diffract.py:124:17: F405 `grid_points` may be undefined, or defined from star imports
    |
122 |         """
123 |         Ny, Nx = field.shape
124 |         in_xy = grid_points(Nx, Ny, dx=self.d_x)
    |                 ^^^^^^^^^^^ F405
125 |         field *= np.exp(
126 |             1j * (np.pi / self.wl_z) * (in_xy[0] ** 2 + in_xy[1] ** 2)
    |

pystarshade/diffraction/diffract.py:134:18: F405 `grid_points` may be undefined, or defined from star imports
    |
132 |         #        output_field = zoom_fft_2d_mod(field, self.N_in, N_out, Z_pad=self.ZP) * (self.d_x**2)
133 |         #        df = (self.max_freq*self.wl_z / (self.ZP*self.N_in + 1))
134 |         out_xy = grid_points(N_out, N_out, dx=df)
    |                  ^^^^^^^^^^^ F405
135 |         quad_out_fac = (
136 |             np.exp(1j * self.k * self.z)
    |

pystarshade/diffraction/diffract.py:173:18: F405 `grid_points` may be undefined, or defined from star imports
    |
171 |         ) * (self.d_x**2)
172 |         df = self.max_freq * self.wl_z / self.N_X
173 |         out_xy = grid_points(N_out, N_out, dx=df)
    |                  ^^^^^^^^^^^ F405
174 |         quad_out_fac = (
175 |             np.exp(1j * self.k * self.z)
    |

pystarshade/diffraction/diffract.py:216:43: F405 `wl_z` may be undefined, or defined from star imports
    |
214 |                 x_trunc[
215 |                     : self.N_in // 2 + bit_x, : self.N_in // 2 + bit_x
216 |                 ] *= np.exp(1j * (np.pi / wl_z) * (xx**2 + yy**2)).astype(
    |                                           ^^^^ F405
217 |                     np.complex128
218 |                 )
    |

pystarshade/diffraction/diffract.py:227:43: F405 `wl_z` may be undefined, or defined from star imports
    |
225 |                 x_trunc[
226 |                     : self.N_in // 2 + bit_x, self.N_in // 2 + bit_x :
227 |                 ] *= np.exp(1j * (np.pi / wl_z) * (xx**2 + yy**2)).astype(
    |                                           ^^^^ F405
228 |                     np.complex128
229 |                 )
    |

pystarshade/diffraction/diffract.py:241:43: F405 `wl_z` may be undefined, or defined from star imports
    |
239 |                 x_trunc[
240 |                     self.N_in // 2 + bit_x :, self.N_in // 2 + bit_x :
241 |                 ] *= np.exp(1j * (np.pi / wl_z) * (xx**2 + yy**2)).astype(
    |                                           ^^^^ F405
242 |                     np.complex128
243 |                 )
    |

pystarshade/diffraction/diffract.py:252:43: F405 `wl_z` may be undefined, or defined from star imports
    |
250 |                 x_trunc[
251 |                     self.N_in // 2 + bit_x :, : self.N_in // 2 + bit_x
252 |                 ] *= np.exp(1j * (np.pi / wl_z) * (xx**2 + yy**2)).astype(
    |                                           ^^^^ F405
253 |                     np.complex128
254 |                 )
    |

pystarshade/diffraction/diffract.py:256:24: F405 `four_chunked_zoom_fft_mod` may be undefined, or defined from star imports
    |
254 |                 )
255 |             x_trunc.flush()
256 |         output_field = four_chunked_zoom_fft_mod(
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^ F405
257 |             x_file, self.N_in, N_out, self.N_X
258 |         ) * (self.d_x**2)
    |

pystarshade/diffraction/diffract.py:260:18: F405 `grid_points` may be undefined, or defined from star imports
    |
258 |         ) * (self.d_x**2)
259 |         df = self.max_freq * self.wl_z / self.N_X
260 |         out_xy = grid_points(N_out, N_out, dx=df)
    |                  ^^^^^^^^^^^ F405
261 |         quad_out_fac = (
262 |             np.exp(1j * self.k * self.z)
    |

pystarshade/diffraction/diffract.py:309:17: F405 `single_chunked_zoom_fft_mod` may be undefined, or defined from star imports
    |
307 |             y = np.arange(-(self.N_in // 2), 1)[np.newaxis, :] * self.d_x
308 |         field *= np.exp(1j * (np.pi / self.wl_z) * (x**2 + y**2))
309 |         field = single_chunked_zoom_fft_mod(
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ F405
310 |             field, self.N_in, N_out, self.N_X, i=chunk
311 |         ) * (self.d_x**2)
    |

pystarshade/diffraction/diffract.py:313:18: F405 `grid_points` may be undefined, or defined from star imports
    |
311 |         ) * (self.d_x**2)
312 |         df = self.max_freq * self.wl_z / self.N_X
313 |         out_xy = grid_points(N_out, N_out, dx=df)
    |                  ^^^^^^^^^^^ F405
314 |         quad_out_fac = (
315 |             np.exp(1j * k * self.z)
    |

pystarshade/diffraction/diffract.py:370:19: F405 `grid_points` may be undefined, or defined from star imports
    |
368 |         Ny, Nx = field_copy.shape
369 |         df = self.max_freq / Nx
370 |         freq_xy = grid_points(Nx, Ny, dx=df)
    |                   ^^^^^^^^^^^ F405
371 |         spectral_field = (
372 |             np.fft.fft2(field_copy)
    |

pystarshade/diffraction/diffract.py:486:18: F405 `grid_points` may be undefined, or defined from star imports
    |
484 |         ) * (self.d_x**2)
485 |         df = self.max_freq * self.wl_z / self.N_X
486 |         out_xy = grid_points(N_out, N_out, dx=df)
    |                  ^^^^^^^^^^^ F405
487 |         out_fac = np.exp(
488 |             (1j * k / (2 * self.z)) * (out_xy[0] ** 2 + out_xy[1] ** 2)
    |

pystarshade/diffraction/field.py:4:1: F403 `from pystarshade.diffraction.util import *` used; unable to detect undefined names
  |
3 | from pystarshade.diffraction.bluestein_fft import zoom_fft_2d_mod
4 | from pystarshade.diffraction.util import *
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
  |

pystarshade/diffraction/util.py:31:5: F841 Local variable `script_dir` is assigned to but never used
   |
29 |     """
30 |     package_path = pkg_resources.resource_filename("pystarshade", "")
31 |     script_dir = os.path.dirname(os.path.abspath(__file__))
   |     ^^^^^^^^^^ F841
32 |     os.environ["BASE_PATH"] = os.path.abspath(
33 |         os.path.join(package_path, "data")
   |
   = help: Remove assignment to unused variable `script_dir`

pystarshade/diffraction/util.py:206:19: E711 Comparison to `None` should be `cond is None`
    |
204 |         The padded 2D array with zeros, centered around the original array.
205 |     """
206 |     if N_out_y == None:
    |                   ^^^^ E711
207 |         N_out_y = N_out_x
208 |     zp_arr = np.zeros(
    |
    = help: Replace with `cond is None`

pystarshade/simulate_field.py:3:1: F403 `from pystarshade.apodization.apodize import *` used; unable to detect undefined names
  |
1 | import numpy as np
2 | 
3 | from pystarshade.apodization.apodize import *
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
4 | from pystarshade.diffraction.diffract import *
5 | from pystarshade.diffraction.field import *
  |

pystarshade/simulate_field.py:4:1: F403 `from pystarshade.diffraction.diffract import *` used; unable to detect undefined names
  |
3 | from pystarshade.apodization.apodize import *
4 | from pystarshade.diffraction.diffract import *
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
5 | from pystarshade.diffraction.field import *
6 | from pystarshade.diffraction.util import *
  |

pystarshade/simulate_field.py:5:1: F403 `from pystarshade.diffraction.field import *` used; unable to detect undefined names
  |
3 | from pystarshade.apodization.apodize import *
4 | from pystarshade.diffraction.diffract import *
5 | from pystarshade.diffraction.field import *
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
6 | from pystarshade.diffraction.util import *
  |

pystarshade/simulate_field.py:6:1: F403 `from pystarshade.diffraction.util import *` used; unable to detect undefined names
  |
4 | from pystarshade.diffraction.diffract import *
5 | from pystarshade.diffraction.field import *
6 | from pystarshade.diffraction.util import *
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
  |

pystarshade/simulate_field.py:31:25: F405 `bluestein_pad` may be undefined, or defined from star imports
   |
29 |         Field in the focal plane.
30 |     """
31 |     field_aperture_ss = bluestein_pad(pupil_field * pupil_mask, N_t, N_pix)
   |                         ^^^^^^^^^^^^^ F405
32 |     fraunhofer = Fraunhofer(dt, dp, N_t, focal_length_lens, wl)
33 |     out_field_ss, dp = fraunhofer.zoom_fraunhofer(field_aperture_ss, N_pix)
   |

pystarshade/simulate_field.py:32:18: F405 `Fraunhofer` may be undefined, or defined from star imports
   |
30 |     """
31 |     field_aperture_ss = bluestein_pad(pupil_field * pupil_mask, N_t, N_pix)
32 |     fraunhofer = Fraunhofer(dt, dp, N_t, focal_length_lens, wl)
   |                  ^^^^^^^^^^ F405
33 |     out_field_ss, dp = fraunhofer.zoom_fraunhofer(field_aperture_ss, N_pix)
34 |     return out_field_ss
   |

pystarshade/simulate_field.py:76:17: F405 `au_to_meter` may be undefined, or defined from star imports
   |
74 |         raise ValueError("starshade mask must be a memmap file")
75 |     N_s = 11
76 |     ds = 0.04 * au_to_meter
   |                 ^^^^^^^^^^^ F405
77 |     source_field = np.zeros((N_s, N_s))
78 |     source_field[N_s // 2, N_s // 2] = 1
   |

pystarshade/simulate_field.py:79:23: F405 `pc_to_meter` may be undefined, or defined from star imports
   |
77 |     source_field = np.zeros((N_s, N_s))
78 |     source_field[N_s // 2, N_s // 2] = 1
79 |     dist_xo_ss = 10 * pc_to_meter
   |                       ^^^^^^^^^^^ F405
80 |     source_prop = SourceField(ds, N_s, wl, dist_xo_ss, source_field)
81 |     field_free_prop = source_prop.farfield(dt, N_t, dist_ss_t)
   |

pystarshade/simulate_field.py:80:19: F405 `SourceField` may be undefined, or defined from star imports
   |
78 |     source_field[N_s // 2, N_s // 2] = 1
79 |     dist_xo_ss = 10 * pc_to_meter
80 |     source_prop = SourceField(ds, N_s, wl, dist_xo_ss, source_field)
   |                   ^^^^^^^^^^^ F405
81 |     field_free_prop = source_prop.farfield(dt, N_t, dist_ss_t)
   |

pystarshade/simulate_field.py:84:15: F405 `FresnelSingle` may be undefined, or defined from star imports
   |
83 |     field_incident_telescope_compl = np.zeros((N_t, N_t), dtype=np.complex128)
84 |     fresnel = FresnelSingle(dx, dt, N_x, dist_ss_t, wl)
   |               ^^^^^^^^^^^^^ F405
85 |     if chunk:
86 |         field_incident_telescope_compl, dt = (
   |

pystarshade/simulate_field.py:93:21: F405 `qu_mask_to_full` may be undefined, or defined from star imports
   |
91 |     else:
92 |         starshade_qu = np.load(ss_mask_fname)
93 |         starshade = qu_mask_to_full(starshade_qu)
   |                     ^^^^^^^^^^^^^^^ F405
94 |         field_incident_telescope_compl, dt = fresnel.zoom_fresnel_single_fft(
95 |             starshade, field_after_ss, N_t
   |

pystarshade/simulate_field.py:95:24: F405 `field_after_ss` may be undefined, or defined from star imports
   |
93 |         starshade = qu_mask_to_full(starshade_qu)
94 |         field_incident_telescope_compl, dt = fresnel.zoom_fresnel_single_fft(
95 |             starshade, field_after_ss, N_t
   |                        ^^^^^^^^^^^^^^ F405
96 |         )
   |

pystarshade/simulate_field.py:112:14: F405 `au_to_meter` may be undefined, or defined from star imports
    |
110 |     N_x=6401,
111 |     N_t=1001,
112 |     ds=0.1 * au_to_meter,
    |              ^^^^^^^^^^^ F405
113 |     dx=0.01,
114 |     dt=0.03,
    |

pystarshade/simulate_field.py:119:10: F405 `PointSource` may be undefined, or defined from star imports
    |
117 |     !!!!!!!! I need checking, likely replace with chunky crazy, along wiht functions in fresnel and fft
118 |     """
119 |     ps = PointSource(dx, N_x, wl, 0, 0, dist_xo_ss, 1)
    |          ^^^^^^^^^^^ F405
120 |     k_vals = ps.wave_numbers()
121 |     field_incident_telescope_compl = np.zeros((N_t, N_t), dtype=np.complex128)
    |

pystarshade/simulate_field.py:120:5: F841 Local variable `k_vals` is assigned to but never used
    |
118 |     """
119 |     ps = PointSource(dx, N_x, wl, 0, 0, dist_xo_ss, 1)
120 |     k_vals = ps.wave_numbers()
    |     ^^^^^^ F841
121 |     field_incident_telescope_compl = np.zeros((N_t, N_t), dtype=np.complex128)
122 |     source_prop = SourceField(ds, N_s, wl, dist_xo_ss, source_field)
    |
    = help: Remove assignment to unused variable `k_vals`

pystarshade/simulate_field.py:122:19: F405 `SourceField` may be undefined, or defined from star imports
    |
120 |     k_vals = ps.wave_numbers()
121 |     field_incident_telescope_compl = np.zeros((N_t, N_t), dtype=np.complex128)
122 |     source_prop = SourceField(ds, N_s, wl, dist_xo_ss, source_field)
    |                   ^^^^^^^^^^^ F405
123 |     #    test_plane = ps.plane_wave(k_vals, 0)
124 |     for chunk in range(4):
    |

pystarshade/simulate_field.py:139:19: F405 `FresnelSingle` may be undefined, or defined from star imports
    |
137 |         elif chunk == 3:
138 |             field_after_ss = np.fliplr(field_after_ss[1:,])
139 |         fresnel = FresnelSingle(dx, dt, N_x, dist_ss_t, wl)
    |                   ^^^^^^^^^^^^^ F405
140 |         field_incident_telescope_compl_quad, dt = (
141 |             fresnel.one_chunk_zoom_fresnel_single_fft(
    |

pystarshade/simulate_field.py:142:17: F405 `self` may be undefined, or defined from star imports
    |
140 |         field_incident_telescope_compl_quad, dt = (
141 |             fresnel.one_chunk_zoom_fresnel_single_fft(
142 |                 self, field, N_out, chunk=0
    |                 ^^^^ F405
143 |             )(field_after_ss, N_t, chunk=chunk)
144 |         )
    |

pystarshade/simulate_field.py:142:23: F405 `field` may be undefined, or defined from star imports
    |
140 |         field_incident_telescope_compl_quad, dt = (
141 |             fresnel.one_chunk_zoom_fresnel_single_fft(
142 |                 self, field, N_out, chunk=0
    |                       ^^^^^ F405
143 |             )(field_after_ss, N_t, chunk=chunk)
144 |         )
    |

pystarshade/simulate_field.py:142:30: F405 `N_out` may be undefined, or defined from star imports
    |
140 |         field_incident_telescope_compl_quad, dt = (
141 |             fresnel.one_chunk_zoom_fresnel_single_fft(
142 |                 self, field, N_out, chunk=0
    |                              ^^^^^ F405
143 |             )(field_after_ss, N_t, chunk=chunk)
144 |         )
    |

pystarshade/simulate_field.py:167:20: F405 `au_to_meter` may be undefined, or defined from star imports
    |
165 |     N_t=1001,
166 |     N_pix=4001,
167 |     ds=10 * 0.03 * au_to_meter,
    |                    ^^^^^^^^^^^ F405
168 |     dx=0.01,
169 |     dt=0.0116,
    |

pystarshade/simulate_field.py:215:19: F405 `SourceField` may be undefined, or defined from star imports
    |
213 |     """
214 | 
215 |     source_prop = SourceField(ds, N_s, wl, dist_xo_ss, source_field)
    |                   ^^^^^^^^^^^ F405
216 |     field_incident_ss = source_prop.farfield(dx, N_x, 0)
    |

pystarshade/simulate_field.py:218:25: F405 `eval_hypergauss` may be undefined, or defined from star imports
    |
216 |     field_incident_ss = source_prop.farfield(dx, N_x, 0)
217 | 
218 |     ss_complement = 1 - eval_hypergauss(N_x, dx)
    |                         ^^^^^^^^^^^^^^^ F405
219 | 
220 |     field_after_ss = field_incident_ss * ss_complement
    |

pystarshade/simulate_field.py:221:22: F405 `bluestein_pad` may be undefined, or defined from star imports
    |
220 |     field_after_ss = field_incident_ss * ss_complement
221 |     field_after_ss = bluestein_pad(field_after_ss, N_x, N_t)
    |                      ^^^^^^^^^^^^^ F405
222 | 
223 |     fresnel = FresnelSingle(dx, dt, N_x, dist_ss_t, wl)
    |

pystarshade/simulate_field.py:223:15: F405 `FresnelSingle` may be undefined, or defined from star imports
    |
221 |     field_after_ss = bluestein_pad(field_after_ss, N_x, N_t)
222 | 
223 |     fresnel = FresnelSingle(dx, dt, N_x, dist_ss_t, wl)
    |               ^^^^^^^^^^^^^ F405
224 |     test_new, dt = fresnel.zoom_fresnel_single_fft(field_after_ss, N_t)
    |

pystarshade/simulate_field.py:228:18: F405 `grey_pupil_func` may be undefined, or defined from star imports
    |
226 |     field_free_prop = source_prop.farfield(dt, N_t, dist_ss_t)
227 | 
228 |     pupil_mask = grey_pupil_func(N_t, dx=dt, r=radius_lens)
    |                  ^^^^^^^^^^^^^^^ F405
229 |     N_xt, N_yt = N_in_2d(
230 |         pupil_mask
    |

pystarshade/simulate_field.py:229:18: F405 `N_in_2d` may be undefined, or defined from star imports
    |
228 |     pupil_mask = grey_pupil_func(N_t, dx=dt, r=radius_lens)
229 |     N_xt, N_yt = N_in_2d(
    |                  ^^^^^^^ F405
230 |         pupil_mask
231 |     )  # Number of non-zero samples in telescope pupil
    |

pystarshade/simulate_field.py:233:29: F405 `bluestein_pad` may be undefined, or defined from star imports
    |
231 |     )  # Number of non-zero samples in telescope pupil
232 | 
233 |     field_aperture_freesp = bluestein_pad(
    |                             ^^^^^^^^^^^^^ F405
234 |         field_free_prop * pupil_mask, N_xt, N_pix
235 |     )
    |

pystarshade/simulate_field.py:236:25: F405 `bluestein_pad` may be undefined, or defined from star imports
    |
234 |         field_free_prop * pupil_mask, N_xt, N_pix
235 |     )
236 |     field_aperture_ss = bluestein_pad(test_new * pupil_mask, N_xt, N_pix)
    |                         ^^^^^^^^^^^^^ F405
237 | 
238 |     fraunhofer = Fraunhofer(dt, dp, N_xt, focal_length_lens, wl)
    |

pystarshade/simulate_field.py:238:18: F405 `Fraunhofer` may be undefined, or defined from star imports
    |
236 |     field_aperture_ss = bluestein_pad(test_new * pupil_mask, N_xt, N_pix)
237 | 
238 |     fraunhofer = Fraunhofer(dt, dp, N_xt, focal_length_lens, wl)
    |                  ^^^^^^^^^^ F405
239 |     out_field_free_space, dp = fraunhofer.zoom_fraunhofer(
240 |         field_aperture_freesp, N_pix
    |

pystarshade/simulate_field.py:314:14: F405 `PointSource` may be undefined, or defined from star imports
    |
312 |     field_incident_ss = np.zeros((N_X, N_X), dtype="complex128")
313 |     for i in range(no_sources):
314 |         ps = PointSource(dx, N_X, wl, *loc_s[i], mag_s[i])
    |              ^^^^^^^^^^^ F405
315 |         pointsource_list.append(ps)
316 |         k_list.append(ps.wave_numbers())
    |

pystarshade/simulate_field.py:324:25: F405 `eval_hypergauss` may be undefined, or defined from star imports
    |
322 |     #    field_incident_ss += gs.far_field_gaussian(gs_A, gs_inv_sigma, 0)
323 | 
324 |     ss_complement = 1 - eval_hypergauss(
    |                         ^^^^^^^^^^^^^^^ F405
325 |         N_X, dx
326 |     )  # Complement of starshade aperture
    |

pystarshade/simulate_field.py:330:15: F405 `FresnelSingle` may be undefined, or defined from star imports
    |
328 |     field_after_ss = field_incident_ss * ss_complement
329 | 
330 |     fresnel = FresnelSingle(dx, dt, N_x, dist_ss_t, wl)
    |               ^^^^^^^^^^^^^ F405
331 |     field_ss_prop, dt = fresnel.zoom_fresnel_single_fft(field_after_ss, N_t)
    |

pystarshade/simulate_field.py:333:18: F405 `grey_pupil_func` may be undefined, or defined from star imports
    |
331 |     field_ss_prop, dt = fresnel.zoom_fresnel_single_fft(field_after_ss, N_t)
332 | 
333 |     pupil_mask = grey_pupil_func(N_t, dx=dt, r=radius_lens)
    |                  ^^^^^^^^^^^^^^^ F405
334 | 
335 |     field_free_prop = np.zeros((N_t, N_t), dtype="complex128")
    |

pystarshade/simulate_field.py:343:18: F405 `N_in_2d` may be undefined, or defined from star imports
    |
341 |     #    field_free_prop += gs.far_field_gaussian(gs_A, gs_inv_sigma, dist_ss_t)
342 | 
343 |     N_xt, N_yt = N_in_2d(
    |                  ^^^^^^^ F405
344 |         pupil_mask
345 |     )  # Number of non-zero samples in telescope pupil
    |

pystarshade/simulate_field.py:347:29: F405 `bluestein_pad` may be undefined, or defined from star imports
    |
345 |     )  # Number of non-zero samples in telescope pupil
346 | 
347 |     field_aperture_freesp = bluestein_pad(
    |                             ^^^^^^^^^^^^^ F405
348 |         field_free_prop * pupil_mask, N_xt, N_pix
349 |     )
    |

pystarshade/simulate_field.py:350:25: F405 `bluestein_pad` may be undefined, or defined from star imports
    |
348 |         field_free_prop * pupil_mask, N_xt, N_pix
349 |     )
350 |     field_aperture_ss = bluestein_pad(field_ss_prop * pupil_mask, N_xt, N_pix)
    |                         ^^^^^^^^^^^^^ F405
351 | 
352 |     fraunhofer = Fraunhofer(dt, dp, N_xt, focal_length_lens, wl)
    |

pystarshade/simulate_field.py:352:18: F405 `Fraunhofer` may be undefined, or defined from star imports
    |
350 |     field_aperture_ss = bluestein_pad(field_ss_prop * pupil_mask, N_xt, N_pix)
351 | 
352 |     fraunhofer = Fraunhofer(dt, dp, N_xt, focal_length_lens, wl)
    |                  ^^^^^^^^^^ F405
353 |     out_field_free_space, dp = fraunhofer.zoom_fraunhofer(
354 |         field_aperture_freesp, N_pix
    |

tests/test_bluestein_fft.py:134:23: F821 Undefined name `four_chunked_zoom_fft`
    |
132 |     x_memmap[:] = x_trunc[:]
133 |     x_memmap.flush()
134 |     test_chunked_bs = four_chunked_zoom_fft("mm_data.dat", N_x, N_out, N_X)
    |                       ^^^^^^^^^^^^^^^^^^^^^ F821
135 |     os.remove("mm_data.dat")
136 |     real_ft_x = np.fft.fftshift(np.fft.fft2(x))[
    |

tests/test_bluestein_fft.py:191:5: F841 Local variable `N_y_seg` is assigned to but never used
    |
190 |     N_x_seg = in_N_X // 2 + bit_x
191 |     N_y_seg = in_N_Y // 2 + bit_y
    |     ^^^^^^^ F841
192 |     shift_seg = N_x_seg // 2 - N_x // 4
    |
    = help: Remove assignment to unused variable `N_y_seg`

tests/test_bluestein_fft.py:192:5: F841 Local variable `shift_seg` is assigned to but never used
    |
190 |     N_x_seg = in_N_X // 2 + bit_x
191 |     N_y_seg = in_N_Y // 2 + bit_y
192 |     shift_seg = N_x_seg // 2 - N_x // 4
    |     ^^^^^^^^^ F841
193 | 
194 |     N_x_1 = max(N_in_2d(x_1))
    |
    = help: Remove assignment to unused variable `shift_seg`

tests/test_bluestein_fft.py:284:23: F821 Undefined name `four_chunked_zoom_fft`
    |
282 |     x_memmap[:] = x_trunc[:]
283 |     x_memmap.flush()
284 |     test_chunked_bs = four_chunked_zoom_fft("mm_data.dat", N_x, N_out, N_X)
    |                       ^^^^^^^^^^^^^^^^^^^^^ F821
285 |     os.remove("mm_data.dat")
    |

tests/test_circle.py:9:1: F403 `from frompystarshade.apodization.apodize import *` used; unable to detect undefined names
   |
 7 | import numpy as np
 8 | import pytest
 9 | from frompystarshade.apodization.apodize import *
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
10 | from frompystarshade.diffraction.diffract import *
11 | from frompystarshade.diffraction.field import *
   |

tests/test_circle.py:10:1: F403 `from frompystarshade.diffraction.diffract import *` used; unable to detect undefined names
   |
 8 | import pytest
 9 | from frompystarshade.apodization.apodize import *
10 | from frompystarshade.diffraction.diffract import *
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
11 | from frompystarshade.diffraction.field import *
12 | from frompystarshade.diffraction.util import *
   |

tests/test_circle.py:11:1: F403 `from frompystarshade.diffraction.field import *` used; unable to detect undefined names
   |
 9 | from frompystarshade.apodization.apodize import *
10 | from frompystarshade.diffraction.diffract import *
11 | from frompystarshade.diffraction.field import *
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
12 | from frompystarshade.diffraction.util import *
13 | from scipy.special import jn
   |

tests/test_circle.py:12:1: F403 `from frompystarshade.diffraction.util import *` used; unable to detect undefined names
   |
10 | from frompystarshade.diffraction.diffract import *
11 | from frompystarshade.diffraction.field import *
12 | from frompystarshade.diffraction.util import *
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F403
13 | from scipy.special import jn
   |

tests/test_circle.py:20:17: F405 `pc_to_meter` may be undefined, or defined from star imports
   |
18 | R_lens = 2.4
19 | R_ss = 30
20 | dist_xo_ss = 10*pc_to_meter
   |                 ^^^^^^^^^^^ F405
21 | dist_ss_t = 63942090. # distance for hypergaussian mask
22 | N_t = 257
   |

tests/test_circle.py:116:10: F405 `PointSource` may be undefined, or defined from star imports
    |
114 |     """ Fresnel diffraction via PyStarshade for comparison to analytic circle mask diffraction"""
115 | 
116 |     ps = PointSource(dx, N_x, wl, 0, 0, dist_xo_ss, 1)
    |          ^^^^^^^^^^^ F405
117 |     k_vals = ps.wave_numbers()
118 |     field_incident_ss = ps.plane_wave(k_vals, 0)
    |

tests/test_circle.py:120:21: F405 `grey_pupil_func` may be undefined, or defined from star imports
    |
118 |     field_incident_ss = ps.plane_wave(k_vals, 0)
119 | 
120 |     ss_complement = grey_pupil_func(N_x, dx, R_ss)
    |                     ^^^^^^^^^^^^^^^ F405
121 |     field_after_ss = field_incident_ss * ss_complement
    |

tests/test_circle.py:123:15: F405 `FresnelSingle` may be undefined, or defined from star imports
    |
121 |     field_after_ss = field_incident_ss * ss_complement
122 | 
123 |     fresnel = FresnelSingle(dx, dt, N_x, dist_ss_t, wl)
    |               ^^^^^^^^^^^^^ F405
124 |     field_aperture, dt = fresnel.zoom_fresnel_single_fft(field_after_ss, N_t)
    |

Found 126 errors (14 fixed, 112 remaining).
No fixes available (7 hidden fixes can be enabled with the `--unsafe-fixes` option).

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

tests/test_circle.py:20: error: Name "pc_to_meter" is not defined  [name-defined]
pystarshade/diffraction/util.py:4: error: Library stubs not installed for "pkg_resources"  [import-untyped]
pystarshade/diffraction/util.py:4: note: Hint: "python3 -m pip install types-setuptools"
pystarshade/diffraction/util.py:4: note: (or run "mypy --install-types" to install all missing stub packages)
pystarshade/diffraction/util.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
pystarshade/apodization/pupil.py:19: error: Name "make_circular_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:20: error: Name "make_elt_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:21: error: Name "make_gmt_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:22: error: Name "make_tmt_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:23: error: Name "make_hale_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:24: error: Name "make_luvoir_a_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:25: error: Name "make_luvoir_b_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:26: error: Name "make_magellan_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:27: error: Name "make_vlt_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:28: error: Name "make_hicat_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:29: error: Name "make_habex_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:30: error: Name "make_hst_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:31: error: Name "make_jwst_aperture" is not defined  [name-defined]
pystarshade/apodization/pupil.py:32: error: Name "make_keck_aperture" is not defined  [name-defined]
examples/visualize_throughput.py:24: error: Name "fname" is not defined  [name-defined]
examples/visualize_throughput.py:25: error: Name "fname" is not defined  [name-defined]
examples/simple_point_source.py:6: error: Name "np" is not defined  [name-defined]
examples/simple_point_source.py:10: error: Name "np" is not defined  [name-defined]
pystarshade/data/masks/mp_gen_mask.py:104: error: Name "convolve" is not defined  [name-defined]
pystarshade/data/masks/mp_gen_mask.py:109: error: Name "final_dx_str" is not defined  [name-defined]
examples/exovista_sim.py:39: error: Name "Scene" is not defined  [name-defined]
examples/exovista_sim.py:55: error: Name "np" is not defined  [name-defined]
examples/exovista_sim.py:59: error: Name "np" is not defined  [name-defined]
examples/exovista_sim.py:71: error: Name "np" is not defined  [name-defined]
examples/exovista_sim.py:95: error: Name "np" is not defined  [name-defined]
examples/exovista_sim.py:110: error: Name "np" is not defined  [name-defined]
examples/exovista_sim.py:122: error: Name "np" is not defined  [name-defined]
Found 29 errors in 7 files (checked 35 source files)

typos....................................................................Failed
- hook id: typos
- exit code: 2

error: `paramters` should be `parameters`
  --> pystarshade/propagator.py:53:70
   |
53 |                 "Design reference mission not set. Insert instrument paramters into data/telescope_drm.py"
   |                                                                      ^^^^^^^^^
   |
error: `multipled` should be `multiplied`
  --> docs/content/fft.rst:4:442
  |
4 | When a starshade is aligned with a star, starlight is diffracted by the starshade :math:`s(\mathbf{x})` onto a telescope aperture. For a starshade mask :math:`s(u, v)` which is zero inside the mask and unity outside, at a wavelength :math:`\lambda` and starshade-telescope distance :math:`z`, the field at the telescope aperture is :math:`f_{\lambda}(x, y)` (Eq :eq:`bluestein`) and is related to the Fourier transform of the starshade mask multipled by a highly oscillatory chirp term.
  |                                                                                                                                                                                                                                                                                                                                                                                                                                                          ^^^^^^^^^
  |
error: `Sebastiaan` should be `Sebastian`
  --> docs/paper/paper.bib:58:49
   |
58 |        author = {{Por}, Emiel H. and {Haffert}, Sebastiaan Y. and {Radhakrishnan}, Vikram M. and {Doelman}, David S. and {van Kooten}, Maaike and {Bos}, Steven P.},
   |                                                 ^^^^^^^^^^
   |
error: `wiht` should be `with`
  --> pystarshade/simulate_field.py:117:71
    |
117 |     !!!!!!!! I need checking, likely replace with chunky crazy, along wiht functions in fresnel and fft
    |                                                                       ^^^^
    |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants