Skip to content

Commit

Permalink
move utils folder (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
joglekara authored Jul 25, 2024
1 parent ce542b6 commit 92cb191
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 13 deletions.
11 changes: 6 additions & 5 deletions adept/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
from jax import numpy as jnp


from utils import misc


def get_envelope(p_wL, p_wR, p_L, p_R, ax):
return 0.5 * (jnp.tanh((ax - p_L) / p_wL) - jnp.tanh((ax - p_R) / p_wR))

Expand Down Expand Up @@ -224,9 +221,11 @@ def setup(self, cfg: Dict, adept_module: ADEPTModule = None) -> Dict[str, Module
self.mlflow_run_id = mlflow_run.info.run_id

else:
from adept.utils.misc import get_cfg

with mlflow.start_run(run_id=self.mlflow_run_id, nested=self.mlflow_nested) as mlflow_run:
with tempfile.TemporaryDirectory(dir=self.base_tempdir) as temp_path:
cfg = misc.get_cfg(artifact_uri=mlflow_run.info.artifact_uri, temp_path=temp_path)
cfg = get_cfg(artifact_uri=mlflow_run.info.artifact_uri, temp_path=temp_path)
modules = self._setup_(cfg, td, adept_module)
mlflow.log_artifacts(td) # logs the temporary directory to mlflow

Expand Down Expand Up @@ -261,6 +260,8 @@ def _get_adept_module_(self, cfg: Dict) -> ADEPTModule:
return this_module(cfg)

def _setup_(self, cfg: Dict, td: str, adept_module: ADEPTModule = None, log: bool = True) -> Dict[str, Module]:
from adept.utils.misc import log_params

if adept_module is None:
self.adept_module = self._get_adept_module_(cfg)
else:
Expand All @@ -281,7 +282,7 @@ def _setup_(self, cfg: Dict, td: str, adept_module: ADEPTModule = None, log: boo
self.adept_module.get_derived_quantities() # gets the derived quantities

if log:
misc.log_params(self.adept_module.cfg) # logs the parameters to mlflow
log_params(self.adept_module.cfg) # logs the parameters to mlflow
with open(os.path.join(td, "derived_config.yaml"), "w") as fi:
yaml.dump(self.adept_module.cfg, fi)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import yaml

from adept import ergoExo
from utils.misc import export_run
from adept.utils.misc import export_run


if __name__ == "__main__":
Expand Down
1 change: 0 additions & 1 deletion tests/test_lpse2d/test_epw_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from numpy import testing

# from utils.runner import run
from adept.theory.electrostatic import get_roots_to_electrostatic_dispersion, get_nlfs
from adept import ergoExo

Expand Down
4 changes: 2 additions & 2 deletions tests/test_lpse2d/test_tpd_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from adept.lpse2d.helpers import calc_threshold_intensity

import numpy as np
from utils.misc import setup_parsl
from adept.utils.misc import setup_parsl

# from parsl.app.app import python_app

Expand All @@ -11,7 +11,7 @@
def run_once(L, Te, I0):
import yaml
from adept import ergoExo
from utils.misc import export_run
from adept.utils.misc import export_run

with open("tests/test_lpse2d/configs/tpd.yaml", "r") as fi:
cfg = yaml.safe_load(fi)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_tf1d/test_against_vlasov.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from adept.theory import electrostatic
from adept import ergoExo

# from utils.runner import run


def _modify_defaults_(defaults):
rand_k0 = 0.358
Expand Down
2 changes: 0 additions & 2 deletions tests/test_vfp1d/test_kappa_eh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from adept import ergoExo

# from utils.runner import run


def _run_(Z, ee):
# with open("configs/tf-1d/damping.yaml", "r") as fi:
Expand Down

0 comments on commit 92cb191

Please sign in to comment.