Spaces:
Running
Running
Commit
·
e199c99
1
Parent(s):
db7e681
Don't return julia output, store in global state
Browse files- pysr/sr.py +6 -2
pysr/sr.py
CHANGED
|
@@ -25,6 +25,7 @@ global_state = dict(
|
|
| 25 |
multioutput=False,
|
| 26 |
nout=1,
|
| 27 |
selection=None,
|
|
|
|
| 28 |
)
|
| 29 |
|
| 30 |
already_ran = False
|
|
@@ -499,7 +500,7 @@ def pysr(
|
|
| 499 |
|
| 500 |
cprocs = 0 if multithreading else procs
|
| 501 |
|
| 502 |
-
|
| 503 |
Main.X,
|
| 504 |
Main.y,
|
| 505 |
weights=Main.weights,
|
|
@@ -522,6 +523,7 @@ def pysr(
|
|
| 522 |
multioutput=multioutput,
|
| 523 |
nout=nout,
|
| 524 |
selection=selection,
|
|
|
|
| 525 |
)
|
| 526 |
|
| 527 |
equations = get_hof(
|
|
@@ -541,7 +543,7 @@ def pysr(
|
|
| 541 |
if delete_tempfiles:
|
| 542 |
shutil.rmtree(tmpdir)
|
| 543 |
|
| 544 |
-
return equations
|
| 545 |
|
| 546 |
|
| 547 |
def _set_globals(
|
|
@@ -557,6 +559,7 @@ def _set_globals(
|
|
| 557 |
multioutput,
|
| 558 |
nout,
|
| 559 |
selection,
|
|
|
|
| 560 |
):
|
| 561 |
global global_state
|
| 562 |
|
|
@@ -571,6 +574,7 @@ def _set_globals(
|
|
| 571 |
global_state["multioutput"] = multioutput
|
| 572 |
global_state["nout"] = nout
|
| 573 |
global_state["selection"] = selection
|
|
|
|
| 574 |
|
| 575 |
|
| 576 |
def _handle_constraints(binary_operators, unary_operators, constraints):
|
|
|
|
| 25 |
multioutput=False,
|
| 26 |
nout=1,
|
| 27 |
selection=None,
|
| 28 |
+
raw_julia_output=None,
|
| 29 |
)
|
| 30 |
|
| 31 |
already_ran = False
|
|
|
|
| 500 |
|
| 501 |
cprocs = 0 if multithreading else procs
|
| 502 |
|
| 503 |
+
raw_julia_output = Main.EquationSearch(
|
| 504 |
Main.X,
|
| 505 |
Main.y,
|
| 506 |
weights=Main.weights,
|
|
|
|
| 523 |
multioutput=multioutput,
|
| 524 |
nout=nout,
|
| 525 |
selection=selection,
|
| 526 |
+
raw_julia_output=raw_julia_output,
|
| 527 |
)
|
| 528 |
|
| 529 |
equations = get_hof(
|
|
|
|
| 543 |
if delete_tempfiles:
|
| 544 |
shutil.rmtree(tmpdir)
|
| 545 |
|
| 546 |
+
return equations
|
| 547 |
|
| 548 |
|
| 549 |
def _set_globals(
|
|
|
|
| 559 |
multioutput,
|
| 560 |
nout,
|
| 561 |
selection,
|
| 562 |
+
raw_julia_output,
|
| 563 |
):
|
| 564 |
global global_state
|
| 565 |
|
|
|
|
| 574 |
global_state["multioutput"] = multioutput
|
| 575 |
global_state["nout"] = nout
|
| 576 |
global_state["selection"] = selection
|
| 577 |
+
global_state["raw_julia_output"] = raw_julia_output
|
| 578 |
|
| 579 |
|
| 580 |
def _handle_constraints(binary_operators, unary_operators, constraints):
|