Skip to content

Commit

Permalink
change: Refactor method names for animating mode 2 in Example2 and Ex…
Browse files Browse the repository at this point in the history
…ample3

- Renamed `Pali_ss.anim_mode_g2` to `Pali_ss.anim_mode_geo2` in `Example2 - Real dataset.rst`
- Renamed `msp.anim_mode_g2` to `msp.anim_mode_geo2` in `Example3 - Multisetup PoSER.rst`
- Updated method calls in relevant test files
  • Loading branch information
dfm88 committed Sep 22, 2024
1 parent 35636c7 commit 4f9458f
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 25 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Renamed `anim_mode_g2` to `anim_mode_geo2` in `GeometryMixin` class
- Updated hierarchy for results and run_params classes


## [1.0.0] - 2024-09-12

Expand Down
4 changes: 2 additions & 2 deletions Examples/Example2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@
"outputs": [],
"source": [
"# Animate mode 1 (geometry 2)\n",
"_ = Pali_ss.anim_mode_g2(\n",
"_ = Pali_ss.anim_mode_geo2(\n",
" algo_res=ssicov.result, mode_nr=1, scaleF=3)"
]
},
Expand Down Expand Up @@ -733,7 +733,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions Examples/Example3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
"outputs": [],
"source": [
"# Animate mode 5 (geometry 2, pyvista)\n",
"_ = msp.anim_mode_g2(\n",
"_ = msp.anim_mode_geo2(\n",
" algo_res=algoRes, mode_nr=5, scaleF=3, notebook=True)"
]
},
Expand Down Expand Up @@ -414,7 +414,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/Example2 - Real dataset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ the analysis
.. code:: python
# Animate mode 1 (geometry 2)
Pali_ss.anim_mode_g2(
Pali_ss.anim_mode_geo2(
algo_res=ssicov.result, mode_nr=1, scaleF=3)
.. image:: /img/Ex2-Fig15.gif
Expand Down
2 changes: 1 addition & 1 deletion docs/Example3 - Multisetup PoSER.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ geometry on it and then plot or animate the mode shapes
_, _ = msp.plot_mode_geo2_mpl(
algo_res=algoRes, mode_nr=4, view="xz", scaleF=3)
# Animate mode 5 (geometry 2, pyvista)
_ = msp.anim_mode_g2(
_ = msp.anim_mode_geo2(
algo_res=algoRes, mode_nr=5, scaleF=3)
.. figure:: /img/Ex3-Fig4.png
Expand Down
11 changes: 2 additions & 9 deletions src/pyoma2/algorithms/data/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class FDDResult(BaseResult):
S_vec: typing.Optional[npt.NDArray[np.float64]] = None


class EFDDResult(BaseResult):
class EFDDResult(FDDResult):
"""
Class for storing results data from Enhanced Frequency Domain Decomposition (EFDD)
and Frequency Spatial Domain Decomposition (FSDD).
Expand All @@ -75,10 +75,6 @@ class EFDDResult(BaseResult):
A list to store data for plotting purposes.
"""

freq: typing.Optional[npt.NDArray[np.float64]] = None
Sy: typing.Optional[npt.NDArray[np.float64]] = None
S_val: typing.Optional[npt.NDArray[np.float64]] = None
S_vec: typing.Optional[npt.NDArray[np.float64]] = None
# dopo mpe, MPE_forPlot
Xi: typing.Optional[npt.NDArray[np.float64]] = None # array of damping ratios
forPlot: typing.Optional[typing.List] = None
Expand Down Expand Up @@ -193,7 +189,7 @@ class pLSCFResult(BaseResult):
order_out: typing.Union[typing.List[int], int, None] = None


class MsPoserResult(BaseModel):
class MsPoserResult(BaseResult):
"""
Base class for MultiSetup Poser result data.
Expand All @@ -211,9 +207,6 @@ class MsPoserResult(BaseModel):
Covariance of damping ratios.
"""

model_config = ConfigDict(from_attributes=True, arbitrary_types_allowed=True)
Phi: npt.NDArray[np.float64]
Fn: npt.NDArray[np.float64]
Fn_cov: npt.NDArray[np.float64]
Xi: npt.NDArray[np.float64]
Xi_cov: npt.NDArray[np.float64]
14 changes: 7 additions & 7 deletions src/pyoma2/algorithms/data/run_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FDDRunParams(BaseRunParams):

# METODO 1: run
nxseg: int = 1024
method_SD: str = "per"
method_SD: typing.Literal["per", "cor"] = "per"
pov: float = 0.5
# METODO 2: mpe e mpe_from_plot
sel_freq: typing.Optional[npt.NDArray[np.float64]] = None
Expand Down Expand Up @@ -85,7 +85,7 @@ class EFDDRunParams(BaseRunParams):

# METODO 1: run
nxseg: int = 1024
method_SD: str = "per"
method_SD: typing.Literal["per", "cor"] = "per"
pov: float = 0.5
# METODO 2: mpe e mpe_from_plot
sel_freq: typing.Optional[npt.NDArray[np.float64]] = None
Expand Down Expand Up @@ -154,8 +154,8 @@ class SSIRunParams(BaseRunParams):
ordmin: int = 0
ordmax: typing.Optional[int] = None
step: int = 1
sc: dict = dict(err_fn=0.01, err_xi=0.05, err_phi=0.03) # soft criteria
hc: dict = dict(
sc: typing.Dict = dict(err_fn=0.01, err_xi=0.05, err_phi=0.03) # soft criteria
hc: typing.Dict = dict(
conj=True, xi_max=0.1, mpc_lim=0.7, mpd_lim=0.3, cov_max=0.2
) # hard criteria
calc_unc: bool = False # uncertainty calculations
Expand Down Expand Up @@ -217,12 +217,12 @@ class pLSCFRunParams(BaseRunParams):
ordmax: int
ordmin: int = 0
nxseg: int = 1024
method_SD: str = "per"
method_SD: typing.Literal["per", "cor"] = "per"
pov: float = 0.5
# sgn_basf: int = -1
# step: int = 1
sc: dict = dict(err_fn=0.01, err_xi=0.05, err_phi=0.03)
hc: dict = dict(conj=True, xi_max=0.1, mpc_lim=0.7, mpd_lim=0.3)
sc: typing.Dict = dict(err_fn=0.01, err_xi=0.05, err_phi=0.03)
hc: typing.Dict = dict(conj=True, xi_max=0.1, mpc_lim=0.7, mpd_lim=0.3)
# METODO 2: mpe e mpe_from_plot
sel_freq: typing.Optional[typing.List[float]] = None
order_in: typing.Union[int, str] = "find_min"
Expand Down
2 changes: 1 addition & 1 deletion src/pyoma2/support/geometry/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def plot_mode_geo2_mpl(
return fig, ax

# PLOT MODI - PyVista plotter
def anim_mode_g2(
def anim_mode_geo2(
self,
algo_res: BaseResult,
mode_nr: int = 1,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/setup/test_multi_setup_poser.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_geo2(ms_poser: MultiSetup_PoSER) -> None:
# define results variable
algo_res = result["the_coolest_algo"]

# PLOTE_MODE_G2
# PLOTE_MODE_geo2
try:
_ = ms_poser.plot_mode_geo2(algo_res=algo_res, mode_nr=1, scaleF=3, notebook=True)
# assert isinstance(fig, Figure)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/setup/test_single_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def test_run(ss: SingleSetup) -> None:
except Exception as e:
assert False, f"plot_mode_geo1 raised an exception {e} for FDD"

# PLOTE_MODE_G2
# PLOTE_MODE_geo2
try:
_ = ss.plot_mode_geo2(algo_res=fsdd.result, mode_nr=2, view="3D", scaleF=2)
except Exception as e:
Expand Down

0 comments on commit 4f9458f

Please sign in to comment.