Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve ab initio DataCard __init__ #88

Open
MicahGale opened this issue Jun 7, 2022 · 9 comments · Fixed by #595 · May be fixed by #608
Open

Improve ab initio DataCard __init__ #88

MicahGale opened this issue Jun 7, 2022 · 9 comments · Fixed by #595 · May be fixed by #608
Assignees
Labels
feature request An issue that improves the user interface. good first issue Good for newcomers mccafe ☕ Issues that need to be resolved before the MCCAFE MontePy port
Milestone

Comments

@MicahGale
Copy link
Collaborator

Users would like a stop gap measure to add special DataCards like nps 2e9 without needing full support for the nps card yet.

Right now to do this the user would have to make a string for the card put in a list, generate a new Card, and then use that Card to generate a new DataCard.

@MicahGale
Copy link
Collaborator Author

Probably make a factory so we don't break the existing signature.

@MicahGale
Copy link
Collaborator Author

Support for str or [str]

@MicahGale
Copy link
Collaborator Author

My two cents: MCCAFE shouldn't be making data cards from scratch for release 1.0. I think we need to support everything MCCAFE needs mainly #15.

@MicahGale
Copy link
Collaborator Author

In GitLab by @tjlaboss on Dec 21, 2023, 15:05

Bare minimum:

  • sdef
  • nps
  • kcode
  • nonu

https://experiment_analysis_all.pages.hpc.inl.gov/software/MCCAFE/um/output/decks.html#data-cards

@MicahGale
Copy link
Collaborator Author

Thinking about this more I think this feature should be implemented for all objects. I'm thinking:

class MCNP_Object:

    @staticmethod
    def create_from_str(cls, strs):
      # make input
     # invoke init

I'm split though if it should take ["line 1", "line 2"] or """line 1\nline 2"""

@MicahGale
Copy link
Collaborator Author

In GitLab by @tjlaboss on Jan 5, 2024, 10:51

haha you're .split()

First thought is that if I'm a new user and want to create a card from a string, I expect just to give it a valid line of text and for it to work, including handling the line wrapping. This is probably more important than catering to an advanced user with pedantic formatting tastes (i.e. @tjlaboss).

@MicahGale
Copy link
Collaborator Author

and pedants can always do "\n".join(["line 1", "line 2"]).

@MicahGale
Copy link
Collaborator Author

I'm thinking what if we added montepy.parse(input: str)?

Like you could do:

cell = montepy.parse("1 0 -1 imp:n =1")
surf = montepy.parse(" 1 pz 10")
mat = montepy.parse("m1 1001.80c 1.0")

I think for this it would have to try: data -> surface -> cell due to easiest to hardest parsers.

Thoughts @tjlaboss?

@MicahGale
Copy link
Collaborator Author

I'm thinking it would be fine to allow __init__ to accept a str as input.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature request An issue that improves the user interface. good first issue Good for newcomers mccafe ☕ Issues that need to be resolved before the MCCAFE MontePy port
Projects
None yet
2 participants