Skip to content

Commit f694d6a

Browse files
committed
Adjust import order
1 parent 6485aef commit f694d6a

15 files changed

Lines changed: 35 additions & 28 deletions

File tree

src/openlifu/bf/apod_methods/apodmethod.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Any
66

77
import numpy as np
8+
import pandas as pd
89
import xarray as xa
910

1011
from openlifu.bf import apod_methods
@@ -32,7 +33,7 @@ def from_dict(d):
3233
return class_constructor(**d)
3334

3435
@abstractmethod
35-
def to_table(self):
36+
def to_table(self) -> pd.DataFrame:
3637
"""
3738
Get a table of the apodization method parameters
3839

src/openlifu/bf/apod_methods/maxangle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Annotated
55

66
import numpy as np
7+
import pandas as pd
78
import xarray as xa
89

910
from openlifu.bf.apod_methods import ApodizationMethod
@@ -37,13 +38,12 @@ def calc_apodization(self, arr: Transducer, target: Point, params: xa.Dataset, t
3738
apod[angles <= self.max_angle] = 1
3839
return apod
3940

40-
def to_table(self):
41+
def to_table(self) -> pd.DataFrame:
4142
"""
4243
Get a table of the apodization method parameters
4344
4445
:returns: Pandas DataFrame of the apodization method parameters
4546
"""
46-
import pandas as pd
4747
records = [{"Name": "Type", "Value": "Max Angle", "Unit": ""},
4848
{"Name": "Max Angle", "Value": self.max_angle, "Unit": self.units}]
4949
return pd.DataFrame.from_records(records)

src/openlifu/bf/apod_methods/piecewiselinear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Annotated
55

66
import numpy as np
7+
import pandas as pd
78
import xarray as xa
89

910
from openlifu.bf.apod_methods import ApodizationMethod
@@ -47,13 +48,12 @@ def calc_apodization(self, arr: Transducer, target: Point, params: xa.Dataset, t
4748
apod = np.maximum(0, np.minimum(1, f))
4849
return apod
4950

50-
def to_table(self):
51+
def to_table(self) -> pd.DataFrame:
5152
"""
5253
Get a table of the apodization method parameters
5354
5455
:returns: Pandas DataFrame of the apodization method parameters
5556
"""
56-
import pandas as pd
5757
records = [
5858
{"Name": "Type", "Value": "Piecewise-Linear", "Unit": ""},
5959
{"Name": "Zero Angle", "Value": self.zero_angle, "Unit": self.units},

src/openlifu/bf/apod_methods/uniform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Annotated
55

66
import numpy as np
7+
import pandas as pd
78
import xarray as xa
89

910
from openlifu.bf.apod_methods import ApodizationMethod
@@ -26,7 +27,6 @@ def to_table(self):
2627
2728
:returns: Pandas DataFrame of the apodization method parameters
2829
"""
29-
import pandas as pd
3030
records = [{"Name": "Type", "Value": "Uniform", "Unit": ""},
3131
{"Name": "Value", "Value": self.value, "Unit": ""}]
3232
return pd.DataFrame.from_records(records)

src/openlifu/bf/delay_methods/delaymethod.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from dataclasses import dataclass
55

66
import numpy as np
7+
import pandas as pd
78
import xarray as xa
89

910
from openlifu.bf import delay_methods
@@ -31,7 +32,7 @@ def from_dict(d):
3132
return class_constructor(**d)
3233

3334
@abstractmethod
34-
def to_table(self):
35+
def to_table(self) -> pd.DataFrame:
3536
"""
3637
Get a table of the delay method parameters
3738

src/openlifu/bf/delay_methods/direct.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Annotated
55

66
import numpy as np
7+
import pandas as pd
78
import xarray as xa
89

910
from openlifu.bf.delay_methods import DelayMethod
@@ -36,13 +37,12 @@ def calc_delays(self, arr: Transducer, target: Point, params: xa.Dataset | None=
3637
delays = max(tof) - tof
3738
return delays
3839

39-
def to_table(self):
40+
def to_table(self) -> pd.DataFrame:
4041
"""
4142
Get a table of the delay method parameters
4243
4344
:returns: Pandas DataFrame of the delay method parameters
4445
"""
45-
import pandas as pd
4646
records = [{"Name": "Type", "Value": "Direct", "Unit": ""},
4747
{"Name": "Default Sound Speed", "Value": self.c0, "Unit": "m/s"}]
4848
return pd.DataFrame.from_records(records)

src/openlifu/bf/focal_patterns/focal_pattern.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from dataclasses import dataclass
55
from typing import Annotated
66

7+
import pandas as pd
8+
79
from openlifu.bf import focal_patterns
810
from openlifu.geo import Point
911
from openlifu.util.annotations import OpenLIFUFieldData
@@ -74,7 +76,7 @@ def from_dict(d):
7476
return class_constructor(**d)
7577

7678
@abstractmethod
77-
def to_table(self):
79+
def to_table(self) -> pd.DataFrame:
7880
"""
7981
Get a table of the focal pattern parameters
8082

src/openlifu/bf/focal_patterns/single.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from dataclasses import dataclass
44

5+
import pandas as pd
6+
57
from openlifu.bf.focal_patterns import FocalPattern
68
from openlifu.geo import Point
79

@@ -30,13 +32,12 @@ def num_foci(self):
3032
"""
3133
return 1
3234

33-
def to_table(self):
35+
def to_table(self) -> pd.DataFrame:
3436
"""
3537
Get a table of the focal pattern parameters
3638
3739
:returns: Pandas DataFrame of the focal pattern parameters
3840
"""
39-
import pandas as pd
4041
records = [{"Name": "Type", "Value": "Single Point", "Unit": ""},
4142
{"Name": "Target Pressure", "Value": self.target_pressure, "Unit": self.units}]
4243
return pd.DataFrame.from_records(records)

src/openlifu/bf/focal_patterns/wheel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Annotated
55

66
import numpy as np
7+
import pandas as pd
78

89
from openlifu.bf.focal_patterns import FocalPattern
910
from openlifu.geo import Point
@@ -71,13 +72,12 @@ def num_foci(self) -> int:
7172
"""
7273
return int(self.center) + self.num_spokes
7374

74-
def to_table(self):
75+
def to_table(self) -> pd.DataFrame:
7576
"""
7677
Get a table of the focal pattern parameters
7778
7879
:returns: Pandas DataFrame of the focal pattern parameters
7980
"""
80-
import pandas as pd
8181
records = [
8282
{"Name": "Type", "Value": "Wheel", "Unit": ""},
8383
{"Name": "Target Pressure", "Value": self.target_pressure, "Unit": self.units},

src/openlifu/bf/pulse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def calc_time(self, dt: float):
5151
"""
5252
return np.arange(0, self.duration, dt)
5353

54-
def to_table(self):
54+
def to_table(self) -> pd.DataFrame:
5555
"""
5656
Get a table of the pulse parameters
5757

0 commit comments

Comments
 (0)