Skip to content

Commit d9207f3

Browse files
committed
Removed some imports that load all of SciPy
1 parent 2dacbb8 commit d9207f3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

py-packages/engine/corelle/engine/cache.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
Mapped database models. These would ideally be in the database module, but
33
they need to be here to avoid initialization issues.
44
"""
5+
56
from sqlalchemy.sql import select
67

78
from rich.progress import Progress
89
from sqlalchemy.dialects.postgresql import insert
10+
from sqlalchemy.sql import text
911
import numpy as N
1012

1113
from corelle.math import quaternion_to_euler
@@ -47,16 +49,16 @@ def build_rotation_caches():
4749
def build_rotation_cache(model, time_step=1):
4850
# Get the time span of the model
4951

50-
min_age = model["min_age"] or 0
51-
max_age = model["max_age"] or 1000
52+
min_age = model.min_age or 0
53+
max_age = model.max_age or 1000
5254

5355
# Get model steps every 1 Myr
5456
t_steps = list(range(int(min_age), int(max_age) + 1, time_step))
5557

5658
session = db.session()
5759

5860
session.execute(
59-
"DELETE FROM corelle.rotation_cache WHERE model_id = :model_id",
61+
text("DELETE FROM corelle.rotation_cache WHERE model_id = :model_id"),
6062
dict(model_id=model.id),
6163
)
6264
session.commit()

py-packages/engine/corelle/engine/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import warnings
22

3-
import numpy as N
43
from IPython import embed
54
from os import environ
65
import click
76
from click import group, argument, option, echo
8-
from corelle.math import quaternion_to_euler
97
from macrostrat.utils import working_directory
108
from pathlib import Path
119

@@ -104,6 +102,8 @@ def rotate(model, plate, time, verbose=False):
104102
"""
105103
Rotate a plate to a time
106104
"""
105+
import numpy as N
106+
from corelle.math import quaternion_to_euler
107107
from .rotate import get_rotation
108108

109109
q = get_rotation(model, plate, time, verbose=verbose)
@@ -124,6 +124,7 @@ def rotate_all(model, time, verbose=False):
124124
"""
125125
Rotate all plates in a model to a time
126126
"""
127+
import numpy as N
127128
from .rotate import get_all_rotations
128129

129130
for plate_id, q in get_all_rotations(model, time, verbose=verbose):

0 commit comments

Comments
 (0)