Skip to content

Commit 4e7e9cd

Browse files
committed
black formatting
1 parent 5ea1a4d commit 4e7e9cd

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

em_workflows/brt/flow.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ def list_paired_files(fnames: List[Path]) -> List[Path]:
322322
pairs.append(Path(fname_no_b))
323323
return pairs
324324

325+
325326
@task
326327
def cleanup_files(file_path: FilePath, pattern=str):
327328
f = f"{file_path.working_dir.as_posix()}/{pattern}"
@@ -331,6 +332,7 @@ def cleanup_files(file_path: FilePath, pattern=str):
331332
os.remove(_file)
332333
print(files_to_rm)
333334

335+
334336
# @task
335337
# def check_inputs_paired(fps: List[Path]):
336338
# """
@@ -424,10 +426,16 @@ def cleanup_files(file_path: FilePath, pattern=str):
424426
tilt_movie_assets = gen_tilt_movie.map(
425427
file_path=fps, upstream_tasks=[keyimg_assets]
426428
)
427-
cleanup_files.map(file_path=fps, pattern=unmapped("*_align_*.mrc"),
428-
upstream_tasks=[tilt_movie_assets, thumb_assets, keyimg_assets])
429-
cleanup_files.map(file_path=fps, pattern=unmapped("*ali*.jpg"),
430-
upstream_tasks=[tilt_movie_assets, thumb_assets, keyimg_assets])
429+
cleanup_files.map(
430+
file_path=fps,
431+
pattern=unmapped("*_align_*.mrc"),
432+
upstream_tasks=[tilt_movie_assets, thumb_assets, keyimg_assets],
433+
)
434+
cleanup_files.map(
435+
file_path=fps,
436+
pattern=unmapped("*ali*.jpg"),
437+
upstream_tasks=[tilt_movie_assets, thumb_assets, keyimg_assets],
438+
)
431439
# END TILT MOVIE GENERATION
432440

433441
# START RECONSTR MOVIE GENERATION:
@@ -444,10 +452,16 @@ def cleanup_files(file_path: FilePath, pattern=str):
444452
file_path=fps, upstream_tasks=[averagedVolume_assets]
445453
)
446454
recon_movie_assets = gen_recon_movie.map(file_path=fps, upstream_tasks=[ave_jpgs])
447-
cleanup_files.map(file_path=fps, pattern=unmapped("*_mp4.*.jpg"),
448-
upstream_tasks=[recon_movie_assets, ave_jpgs])
449-
cleanup_files.map(file_path=fps, pattern=unmapped("*_ave*.mrc"),
450-
upstream_tasks=[recon_movie_assets, ave_jpgs])
455+
cleanup_files.map(
456+
file_path=fps,
457+
pattern=unmapped("*_mp4.*.jpg"),
458+
upstream_tasks=[recon_movie_assets, ave_jpgs],
459+
)
460+
cleanup_files.map(
461+
file_path=fps,
462+
pattern=unmapped("*_ave*.mrc"),
463+
upstream_tasks=[recon_movie_assets, ave_jpgs],
464+
)
451465
# # END RECONSTR MOVIE
452466

453467
# Binned volume assets, for volslicer.

em_workflows/dm_conversion/flow.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def convert_2d_mrc_to_tiff(file_path: FilePath) -> None:
5555
used the smaller of x and y (4092/1024)
5656
"""
5757
utils.log(f"Checking {file_path} for mrc inputs")
58-
large_dim = 1024 # TODO probably config this
58+
large_dim = 1024 # TODO probably config this
5959
if file_path.fp_in.suffix.lower() == ".mrc":
60-
# nifti_fp = neuroglancer.gen_niftis.__wrapped__(file_path)
60+
# nifti_fp = neuroglancer.gen_niftis.__wrapped__(file_path)
6161
# utils.log(f"+++++++++++++++++++++++++++++++++++++++++++++")
6262
# min_max_histo = neuroglancer.gen_min_max_histo(file_path)
6363
# utils.log(min_max_histo)
@@ -179,7 +179,6 @@ def scale_jpegs(file_path: FilePath, size: str) -> Optional[dict]:
179179
return asset_elt
180180

181181

182-
183182
# @task
184183
# def list_files(input_dir: Path, exts: List[str], single_file: str = None) -> List[Path]:
185184
# """
@@ -212,8 +211,6 @@ def scale_jpegs(file_path: FilePath, size: str) -> Optional[dict]:
212211
# return _files
213212

214213

215-
216-
217214
with Flow(
218215
"dm_to_jpeg",
219216
state_handlers=[utils.notify_api_completion, utils.notify_api_running],
@@ -269,7 +266,9 @@ def scale_jpegs(file_path: FilePath, size: str) -> Optional[dict]:
269266
prim_fp=callback_with_thumbs, asset=keyimg_assets
270267
)
271268
# finally filter error states, and convert to JSON and send.
272-
rm_workdirs = utils.cleanup_workdir.map(fp=fps, upstream_tasks=[callback_with_keyimgs])
269+
rm_workdirs = utils.cleanup_workdir.map(
270+
fp=fps, upstream_tasks=[callback_with_keyimgs]
271+
)
273272
filtered_callback = utils.filter_results(callback_with_keyimgs)
274273

275274
callback_sent = utils.send_callback_body(

em_workflows/sem_tomo/flow.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from prefect import Flow, task, Parameter, unmapped
77
from prefect.run_configs import LocalRun
88
from em_workflows.config import Config
9+
910
# from em_workflows.shell_task_echo import ShellTaskEcho
1011
from em_workflows.utils import utils
1112
from em_workflows.utils import neuroglancer as ng
@@ -261,7 +262,7 @@ def gen_keyimg_small(fp_in: FilePath) -> Dict:
261262
- The corrected mrc file is then contrast adjusted with mean std dev magic numbers "150,40" in gen_newstack_norm_command(), this is referred to as the base mrc
262263
- A movie is created using the base.mrc file.
263264
- the midpoint of that file is computed, and snapshots are created using this midpoint.
264-
- We now want to create the pyramid assets, for neuroglancer / viewer.
265+
- We now want to create the pyramid assets, for neuroglancer / viewer.
265266
- Firstly create nifti file using the base mrc, then convert this to ng format.
266267
- To conclude, send callback stating the location of the various outputs.
267268
"""
@@ -298,7 +299,6 @@ def gen_keyimg_small(fp_in: FilePath) -> Dict:
298299
fp_in=fps, upstream_tasks=[stretchs, align_mrcs]
299300
)
300301

301-
302302
base_mrcs = gen_newstack_norm_command.map(
303303
fp_in=fps, upstream_tasks=[corrected_mrc_assets]
304304
)
@@ -338,7 +338,9 @@ def gen_keyimg_small(fp_in: FilePath) -> Dict:
338338
callback_with_corr_movies = utils.add_asset.map(
339339
prim_fp=callback_with_corr_mrcs, asset=corrected_movie_assets
340340
)
341-
rm_workdirs = utils.cleanup_workdir.map(fp=fps, upstream_tasks=[callback_with_corr_movies])
341+
rm_workdirs = utils.cleanup_workdir.map(
342+
fp=fps, upstream_tasks=[callback_with_corr_movies]
343+
)
342344

343345
# finally filter error states, and convert to JSON and send.
344346
filtered_callback = utils.filter_results(callback_with_corr_movies)

0 commit comments

Comments
 (0)