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

Work on cli tools #215

Merged
merged 17 commits into from
Oct 30, 2023
Merged

Work on cli tools #215

merged 17 commits into from
Oct 30, 2023

Conversation

yakutovicha
Copy link
Collaborator

@yakutovicha yakutovicha commented Oct 23, 2023

In this PR I revised our CLI tools to further implement smoke testing.

@yakutovicha yakutovicha marked this pull request as draft October 23, 2023 19:52
@yakutovicha yakutovicha marked this pull request as ready for review October 25, 2023 15:38
@yakutovicha
Copy link
Collaborator Author

yakutovicha commented Oct 25, 2023

@NikoOinonen, @ProkopHapala, I quickly tested things, but might be I missed something. Please have a look and test as well.

Comment on lines +65 to +71
# To fix.
# if common.params["tip"] == ".py":
# # import tip
# exec(compile(open("tip.py", "rb").read(), "tip.py", "exec"))
# print(tipMultipole)
# common.params["tip"] = tipMultipole
# print("params['tip'] ", common.params["tip"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this actually? Looks kinda hacky. Does removing this break any functionality? @ProkopHapala This is your code, I think.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this allows the user to specify tip Multipole as dictionary in tip.py file

it is hacky, but why not

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's kind of confusing, because the tipMultipole just comes into existence out of nowhere and it's difficult to know what it's supposed to be if you don't already have an example of a tip.py file at hand.

It also triggers automated error checkers with messages like "tipMultipole" is not defined, which I'm guessing is the reason why @yakutovicha commented it out.

I would maybe just define an interface through the CLI arguments for this. Something like

--tip 'dz2' -0.1 'pz' 0.05 's' -0.05

should be quite easy to parse into a dictionary.

Copy link
Collaborator

@ProkopHapala ProkopHapala Oct 30, 2023

Choose a reason for hiding this comment

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

cannot we just pass it as string like

"{'dz2':-0.1,'pz':0.05,'s':-0.05}"

and than exec it?

something like this:

if isinstance( common.params["tip"], str):
      exec( 'tipMultipole='+common.params["tip"] )
      common.params["tip"] = tipMultipole

Copy link
Collaborator

Choose a reason for hiding this comment

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

I made a new issue for it: #221.

Copy link
Collaborator

@NikoOinonen NikoOinonen left a comment

Choose a reason for hiding this comment

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

Just a few minor things that I noticed.

ppafm/cli/generateElFF.py Outdated Show resolved Hide resolved
ppafm/cli/generateElFF.py Outdated Show resolved Hide resolved
ppafm/cli/plot_results.py Outdated Show resolved Hide resolved
ppafm/cli/plot_results.py Outdated Show resolved Hide resolved
ppafm/cli/relaxed_scan.py Outdated Show resolved Hide resolved
ppafm/cli/relaxed_scan.py Outdated Show resolved Hide resolved
ppafm/cli/generateDFTD3.py Outdated Show resolved Hide resolved
ppafm/cli/generateElFF.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@NikoOinonen NikoOinonen left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@ProkopHapala ProkopHapala left a comment

Choose a reason for hiding this comment

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

I don't actually see what are the changes.
Just the formatng?
But I don't see obvious reason why not to approve it

Comment on lines +65 to +71
# To fix.
# if common.params["tip"] == ".py":
# # import tip
# exec(compile(open("tip.py", "rb").read(), "tip.py", "exec"))
# print(tipMultipole)
# common.params["tip"] = tipMultipole
# print("params['tip'] ", common.params["tip"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

this allows the user to specify tip Multipole as dictionary in tip.py file

it is hacky, but why not

@yakutovicha yakutovicha merged commit 7481805 into main Oct 30, 2023
14 checks passed
@yakutovicha yakutovicha deleted the chore/ppafm-cli branch October 30, 2023 19:39
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