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

Easier input parameter distributions and load statements for Model objects #208

Closed
wants to merge 2 commits into from

Conversation

sarangbhagwat
Copy link
Member

This adds a new class EasyInputModel that lets users input parameter distributions and the statements to be executed to load values into those parameters by means of pandas DataFrame objects or spreadsheet files.

@sarangbhagwat sarangbhagwat deleted the easy_input_model_staging branch October 31, 2024 19:34
@yoelcortes
Copy link
Member

yoelcortes commented Oct 31, 2024

@sarangbhagwat,

This looks like a fun way to create models. I hope we can work it into the main code a little more. I would suggest the following edits:

  1. Remove the subclass, add the new method to the Model class, rename the new method to parameters_from_df.
  2. Remove namespace_dict from the model __init__, leave it as an input to the parameters_from_df method and rename it to namespace (considering python namespaces are dictionaries, it think we can opt for a shorter name).
  3. Replace namespace default to None (using mutable objects may lead to issues later).
  4. Add new feature to autofill the namespace with all objects in the flowsheet (except if name is already taken):
if namespace is None: 
    namespace = self.system.flowsheet.to_dict()
else:
    namespace = self.system.flowsheet.to_dict() | namespace
  1. Add a test in tests/test_evaluation.py

Thank you! Let me know your thoughts or if you'd like me to help with any implementation.

@sarangbhagwat
Copy link
Member Author

Closed, instead implemented in #209.

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.

2 participants