From 37d41a04ffed750736398df354563dd96365a60e Mon Sep 17 00:00:00 2001 From: Kei Date: Tue, 15 Oct 2024 12:45:07 +0200 Subject: [PATCH 1/2] make mypy happy --- .../postprocessing_h5py/create_hi_pass_viz.py | 5 +++++ .../postprocessing_h5py/spectrograms.py | 1 + 2 files changed, 6 insertions(+) diff --git a/src/vasp/automatedPostprocessing/postprocessing_h5py/create_hi_pass_viz.py b/src/vasp/automatedPostprocessing/postprocessing_h5py/create_hi_pass_viz.py index fccf184..e8d5bcc 100644 --- a/src/vasp/automatedPostprocessing/postprocessing_h5py/create_hi_pass_viz.py +++ b/src/vasp/automatedPostprocessing/postprocessing_h5py/create_hi_pass_viz.py @@ -180,6 +180,7 @@ def create_hi_pass_viz(formatted_data_folder: Path, output_folder: Path, mesh_pa topo_array[...] = topo_array_fsi if quantity in {"d", "v", "p"} and amplitude: + assert vector_data_amplitude is not None geo_array = vector_data_amplitude.create_dataset("Mesh/0/mesh/geometry", (n_nodes_fsi, 3)) geo_array[...] = coord_array_fsi topo_array = vector_data_amplitude.create_dataset("Mesh/0/mesh/topology", (n_elements_fsi, 4), dtype="i") @@ -235,6 +236,7 @@ def create_hi_pass_viz(formatted_data_folder: Path, output_folder: Path, mesh_pa att_type = "Scalar" if amplitude: + assert vector_data_amplitude is not None v_array_amplitude = vector_data_amplitude.create_dataset(array_name, (n_nodes_fsi, 1)) v_array_amplitude[:, 0] = components_data_amplitude[0][:, idx] rms_magnitude[:, idx] = components_data_amplitude[0][:, idx] @@ -263,6 +265,7 @@ def create_hi_pass_viz(formatted_data_folder: Path, output_folder: Path, mesh_pa att_type = "Tensor" if amplitude: + assert vector_data_amplitude is not None array_name = f"{viz_type_amplitude}/{viz_type_amplitude}_{idx}" if idx == 0: assert dof_info is not None @@ -310,6 +313,7 @@ def create_hi_pass_viz(formatted_data_folder: Path, output_folder: Path, mesh_pa array_name = f"{viz_type_magnitude}/{viz_type_magnitude}_{idx}" assert dof_info_amplitude is not None + assert vector_data_mps is not None if idx == 0: for name, data in dof_info_amplitude.items(): dof_array = vector_data_mps.create_dataset(f"{array_name}/{name}", data=data) @@ -326,6 +330,7 @@ def create_hi_pass_viz(formatted_data_folder: Path, output_folder: Path, mesh_pa att_type = "Vector" if amplitude: + assert vector_data_amplitude is not None v_array_amplitude = vector_data_amplitude.create_dataset(array_name, (n_nodes_fsi, 3)) v_array_amplitude[:, 0] = components_data_amplitude[1][:, idx] v_array_amplitude[:, 1] = components_data_amplitude[2][:, idx] diff --git a/src/vasp/automatedPostprocessing/postprocessing_h5py/spectrograms.py b/src/vasp/automatedPostprocessing/postprocessing_h5py/spectrograms.py index f607f5d..a56b261 100755 --- a/src/vasp/automatedPostprocessing/postprocessing_h5py/spectrograms.py +++ b/src/vasp/automatedPostprocessing/postprocessing_h5py/spectrograms.py @@ -460,6 +460,7 @@ def get_spectrogram(dfNearest: pd.DataFrame, fsamp: float, nWindow: int, overlap bins = np.linspace(start_t, end_t, 100) Pxx_mean = interp_spline(freqs, bins) + assert Pxx_mean is not None, "Pxx_mean is None" Pxx_mean[Pxx_mean < 0] = 1e-16 return Pxx_mean, freqs, bins From 319f1260a31f1afc50370ae7bf86be571a47a533 Mon Sep 17 00:00:00 2001 From: Kei Date: Tue, 15 Oct 2024 12:53:24 +0200 Subject: [PATCH 2/2] add --break-system-packages when installing pip --- .github/workflows/build_docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 8ecd206..832750b 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -49,7 +49,7 @@ jobs: - name: Upgrade pip and setuptools run: | - python3 -m pip install pip setuptools --upgrade + python3 -m pip install --break-system-packages pip setuptools --upgrade # See: https://github.com/marketplace/actions/setup-miniconda - name: Setup Mambaforge