Skip to content

Commit e40b37c

Browse files
committed
These functions should no longer be _ functions
1 parent e6049d1 commit e40b37c

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

src/murfey/client/contexts/spa.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
get_machine_config_client,
2323
)
2424
from murfey.util.spa_metadata import (
25-
_foil_hole_data,
26-
_foil_hole_from_file,
27-
_get_grid_square_atlas_positions,
28-
_grid_square_data,
29-
_grid_square_from_file,
25+
foil_hole_data,
26+
foil_hole_from_file,
27+
get_grid_square_atlas_positions,
28+
grid_square_data,
29+
grid_square_from_file,
3030
)
3131

3232
logger = logging.getLogger("murfey.client.contexts.spa")
@@ -371,7 +371,7 @@ def _position_analysis(
371371
source: Path,
372372
machine_config: dict,
373373
) -> Optional[int]:
374-
grid_square = _grid_square_from_file(transferred_file)
374+
grid_square = grid_square_from_file(transferred_file)
375375
grid_square_metadata_file = _grid_square_metadata_file(
376376
transferred_file,
377377
[Path(p) for p in machine_config["data_directories"]],
@@ -413,12 +413,12 @@ def _position_analysis(
413413
local_atlas_path = (
414414
Path(visit_path) / environment.samples[source].atlas
415415
)
416-
gs_pix_position = _get_grid_square_atlas_positions(
416+
gs_pix_position = get_grid_square_atlas_positions(
417417
local_atlas_path,
418418
grid_square=str(grid_square),
419419
)[str(grid_square)]
420420
gs_url = f"{str(environment.url.geturl())}/sessions/{environment.murfey_session}/grid_square/{grid_square}"
421-
gs = _grid_square_data(
421+
gs = grid_square_data(
422422
grid_square_metadata_file,
423423
grid_square,
424424
)
@@ -453,14 +453,14 @@ def _position_analysis(
453453
"angle": gs_pix_position[6],
454454
},
455455
)
456-
foil_hole = _foil_hole_from_file(transferred_file)
456+
foil_hole = foil_hole_from_file(transferred_file)
457457
if foil_hole not in self._foil_holes[grid_square]:
458458
fh_url = f"{str(environment.url.geturl())}/sessions/{environment.murfey_session}/grid_square/{grid_square}/foil_hole"
459459
if (
460460
grid_square_metadata_file.is_file()
461461
and environment.murfey_session is not None
462462
):
463-
fh = _foil_hole_data(
463+
fh = foil_hole_data(
464464
grid_square_metadata_file,
465465
foil_hole,
466466
grid_square,

src/murfey/client/contexts/spa_metadata.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
import xmltodict
77

88
from murfey.client.context import Context
9-
from murfey.client.contexts.spa import _get_grid_square_atlas_positions, _get_source
9+
from murfey.client.contexts.spa import _get_source
1010
from murfey.client.instance_environment import MurfeyInstanceEnvironment, SampleInfo
1111
from murfey.util import authorised_requests, capture_post, get_machine_config_client
12+
from murfey.util.spa_metadata import get_grid_square_atlas_positions
1213

1314
logger = logging.getLogger("murfey.client.contexts.spa_metadata")
1415

@@ -116,7 +117,7 @@ def post_transfer(
116117
.get(str(source), [])
117118
)
118119
if registered_grid_squares:
119-
gs_pix_positions = _get_grid_square_atlas_positions(
120+
gs_pix_positions = get_grid_square_atlas_positions(
120121
source_visit_dir / partial_path
121122
)
122123
for gs in registered_grid_squares:

src/murfey/util/spa_metadata.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ class GridSquareInfo(NamedTuple):
3838
tag: str = ""
3939

4040

41-
def _grid_square_from_file(f: Path) -> int:
41+
def grid_square_from_file(f: Path) -> int:
4242
for p in f.parts:
4343
if p.startswith("GridSquare"):
4444
return int(p.split("_")[1])
4545
raise ValueError(f"Grid square ID could not be determined from path {f}")
4646

4747

48-
def _foil_hole_from_file(f: Path) -> int:
48+
def foil_hole_from_file(f: Path) -> int:
4949
return int(f.name.split("_")[1])
5050

5151

52-
def _get_grid_square_atlas_positions(xml_path: Path, grid_square: str = "") -> Dict[
52+
def get_grid_square_atlas_positions(xml_path: Path, grid_square: str = "") -> Dict[
5353
str,
5454
Tuple[
5555
Optional[int],
@@ -117,7 +117,7 @@ def _get_grid_square_atlas_positions(xml_path: Path, grid_square: str = "") -> D
117117
return gs_pix_positions
118118

119119

120-
def _grid_square_data(xml_path: Path, grid_square: int) -> GridSquareInfo:
120+
def grid_square_data(xml_path: Path, grid_square: int) -> GridSquareInfo:
121121
image_paths = list(
122122
(xml_path.parent.parent).glob(
123123
f"Images-Disc*/GridSquare_{grid_square}/GridSquare_*.jpg"
@@ -147,7 +147,7 @@ def _grid_square_data(xml_path: Path, grid_square: int) -> GridSquareInfo:
147147
return GridSquareInfo(id=grid_square)
148148

149149

150-
def _foil_hole_data(xml_path: Path, foil_hole: int, grid_square: int) -> FoilHoleInfo:
150+
def foil_hole_data(xml_path: Path, foil_hole: int, grid_square: int) -> FoilHoleInfo:
151151
with open(xml_path, "r") as xml:
152152
for_parsing = xml.read()
153153
data = xmltodict.parse(for_parsing)

src/murfey/workflows/spa/flush_spa_preprocess.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
from murfey.util.processing_params import default_spa_parameters
1717
from murfey.util.spa_metadata import (
1818
GridSquareInfo,
19-
_foil_hole_data,
20-
_foil_hole_from_file,
21-
_get_grid_square_atlas_positions,
22-
_grid_square_data,
23-
_grid_square_from_file,
19+
foil_hole_data,
20+
foil_hole_from_file,
21+
get_grid_square_atlas_positions,
22+
grid_square_data,
23+
grid_square_from_file,
2424
)
2525

2626
logger = logging.getLogger("murfey.workflows.spa.flush_spa_preprocess")
@@ -188,15 +188,15 @@ def _flush_position_analysis(
188188
).one()
189189

190190
# Work out the grid square and associated metadata file
191-
grid_square = _grid_square_from_file(movie_path)
191+
grid_square = grid_square_from_file(movie_path)
192192
grid_square_metadata_file = _grid_square_metadata_file(movie_path, grid_square)
193193
if grid_square_metadata_file:
194-
gs = _grid_square_data(grid_square_metadata_file, grid_square)
194+
gs = grid_square_data(grid_square_metadata_file, grid_square)
195195
else:
196196
gs = GridSquareInfo(id=grid_square)
197197
if data_collection_group.atlas:
198198
# If an atlas if present, work out where this grid square is on it
199-
gs_pix_position = _get_grid_square_atlas_positions(
199+
gs_pix_position = get_grid_square_atlas_positions(
200200
data_collection_group.atlas,
201201
grid_square=str(grid_square),
202202
)[str(grid_square)]
@@ -231,9 +231,9 @@ def _flush_position_analysis(
231231
register_grid_square(session_id, gs.id, grid_square_parameters, murfey_db)
232232

233233
# Find the foil hole info and register it
234-
foil_hole = _foil_hole_from_file(movie_path)
234+
foil_hole = foil_hole_from_file(movie_path)
235235
if grid_square_metadata_file:
236-
fh = _foil_hole_data(
236+
fh = foil_hole_data(
237237
grid_square_metadata_file,
238238
foil_hole,
239239
grid_square,

0 commit comments

Comments
 (0)