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

Refactor main script #9

Closed
spencerahill opened this issue Aug 30, 2015 · 5 comments
Closed

Refactor main script #9

spencerahill opened this issue Aug 30, 2015 · 5 comments

Comments

@spencerahill
Copy link
Owner

Currently there are separate classes to parse the arguments in the main routine for calculations and the main routine for plotting, and lots of methods embedded within plotting classes. The parsing functions within the plotting classes should be refactored out -- the plotting classes shouldn't be responsible for parsing user input, only using the results to generate the desired plots.

There should be a single class if possible, or a single parent class that the others inherit from.

Although it needs refactoring as described above, the functionality of the parsing for plotting is more advanced than for the main calculation routine. The latter just permutes all of the specified inputs, attempting to perform a calculation for every possible combination. The former permits passing arguments to specific panels or plots, or across all elements, among other possibilities (although the syntax is pretty confusing).

@spencerahill
Copy link
Owner Author

The main.py and plot.py scripts involved in this business have been migrated to the aospy-obj-lib repo (although I'm not sure in the long run it makes sense to have them there). The Python builtin argparse library should be used as much as possible in this task.

@spencerahill
Copy link
Owner Author

I'm envisioning creating classes that handle this, something along the lines of RunsForCalc, which is effectively just a container of Run objects but signifies without ambiguity that its contents are meant for a single Calc, not to be iterated over to yield multiple Calcs.

Or maybe, to make it more abstract, ObjectsForCalc.

@spencerahill
Copy link
Owner Author

A shell of ObjectsForCalc was implemented: https://github.com/spencerahill/aospy-obj-lib/blob/develop/aospy_user/main.py

These should be brought back into aospy from aospy-obj-lib though.

@spencerahill
Copy link
Owner Author

Plotting has been migrated to it's own repo, so this reduces to cleaning up the main script. That's still a high priority, because we now include it with aospy and feature it heavily in the docs.

All of the classes and other machinery should be refactored into the main repo, with the main script itself only importing a minimum of classes and/or functions to enable the user to execute the script.

@spencerahill spencerahill changed the title Consolidate classes/functions and improve logic for parsing user input Refactor main script Jan 25, 2017
@spencerahill
Copy link
Owner Author

Closing, as this is essentially duplicated within the more up-to-date #152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant