Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PpafmParameters class based on pydantic.BaseModel #275

Merged
merged 23 commits into from
Aug 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1ddffa9
Implement PpafmParameters class based on pydantic.BaseModel
yakutovicha Apr 9, 2024
cb4fdd6
First somehow working version.
yakutovicha Aug 19, 2024
8e06669
Remove defaults/params.ini to avoid confusions.
yakutovicha Aug 19, 2024
f70ec67
Continue switching from params to parameters
yakutovicha Aug 19, 2024
56bfbbd
Fixes
yakutovicha Aug 20, 2024
f04b0cf
Merge branch 'main' into improve/store-config-in-one-class
yakutovicha Aug 20, 2024
bf975a1
Update AFMulator
yakutovicha Aug 21, 2024
2e55280
Remove params dictionary from common.py, continue replacements.
yakutovicha Aug 21, 2024
a7ad91d
Minor fixes
yakutovicha Aug 21, 2024
5397525
Finalise the migration.
yakutovicha Aug 21, 2024
fe8eb22
Allow tip to be a list
yakutovicha Aug 27, 2024
4239788
Backwards compatibility.
yakutovicha Aug 27, 2024
2e82510
Rcore: get deafult value from PpafmParameters
yakutovicha Aug 27, 2024
775032b
Formating changes
yakutovicha Aug 27, 2024
1f1e6f8
Make loadParams part of the PpafmParameters dataclass
yakutovicha Aug 27, 2024
966eb61
Add toml dependencly
yakutovicha Aug 27, 2024
100c68f
Add pyyaml dependency
yakutovicha Aug 27, 2024
1903af1
Make apply_options part of the PpafmParameters class
yakutovicha Aug 27, 2024
2242312
Fix parseAtoms call in plot_results.py
yakutovicha Aug 29, 2024
2ba6441
Get rid of yaml.
yakutovicha Aug 29, 2024
d86fbe6
Get rid of tip_base parameter and rename dump_parameters to to_file
yakutovicha Aug 30, 2024
6985c4c
Add test to the PpafmParameters class
yakutovicha Aug 30, 2024
ef4fbb7
Fix test
yakutovicha Aug 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions ppafm/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class PpafmParameters(pydantic.BaseModel):
colorscale_kpfm: str = "seismic"
ddisp: float = 0.05
aMorse: float = -1.6
tip_base: typing.List = ["None", 0.00]
Copy link
Collaborator Author

@yakutovicha yakutovicha Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to do it, cause Toml was getting crazy trying to parse an inhomogeneous array.

At the same time, the parameter is not used anywhere (checked with get grep tip_base) and was supposed to be removed.

Rtip: float = 30.0
permit: float = 0.00552634959
vdWDampKind: int = 2
Expand Down Expand Up @@ -102,7 +101,7 @@ def apply_options(self, obj):
if hasattr(self, key) and value is not None:
setattr(self, key, value)

def dump_parameters(self, file_path: typing.Union[str, Path] = Path("params.toml")):
def to_file(self, file_path: typing.Union[str, Path] = Path("params.toml")):
"""Save parameters to a file."""
file_path = Path(file_path)
suffix = file_path.suffix
Expand Down Expand Up @@ -163,9 +162,6 @@ def load_ini(self, lines):

self.tip = self.tip.replace('"', "")
self.tip = self.tip.replace("'", "")
# Necessary for working even with quotemarks in params.ini
self.tip_base[0] = self.tip_base[0].replace('"', "")
self.tip_base[0] = self.tip_base[0].replace("'", "")


class CLIParser(ArgumentParser):
Expand Down