File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040 dispersion_on = True ,
4141)
4242
43+ standard_input .to_json (FOLDER / "intermediate_params.json" )
44+ breakpoint ()
4345if __name__ == "__main__" :
4446 # my_simulation.exports = ["pressure", "J_T2"]
4547 output = my_simulation .solve (fast_solve = True )
Original file line number Diff line number Diff line change 11from __future__ import annotations
22from dataclasses import dataclass , replace
3+ from datetime import datetime
4+ from sparging import helpers
35from sparging .correlations import Correlation , all_correlations
46import pint
57from typing import List
@@ -201,15 +203,29 @@ def __post_init__(self):
201203 def to_json (self , path : str ):
202204 import json
203205
206+ output = {
207+ "metadata" : {
208+ "git_commit" : helpers .get_git_hash (),
209+ "date" : datetime .now ().isoformat (),
210+ },
211+ }
212+
213+ output ["intermediate parameters" ] = {}
214+ for node in self .graph .nodes :
215+ output ["intermediate parameters" ][node ] = {
216+ "value" : str (self .graph .nodes [node ]["value" ]),
217+ "origin" : self .graph .nodes [node ]["origin" ],
218+ }
204219 with open (path , "w" ) as f :
205220 json .dump (
206- {
207- key : str (value )
208- for key , value in self .__dict__ .items ()
209- if isinstance (value , pint .Quantity )
210- },
221+ output ,
222+ # {
223+ # key: str(value)
224+ # for key, value in self.__dict__.items()
225+ # if isinstance(value, pint.Quantity)
226+ # },
211227 f ,
212- indent = 2 ,
228+ indent = 4 ,
213229 )
214230
215231 @classmethod
You can’t perform that action at this time.
0 commit comments