Skip to content

Commit

Permalink
fixing code to python standards
Browse files Browse the repository at this point in the history
  • Loading branch information
camilolaiton committed Jun 3, 2024
1 parent 41cd08c commit 772780d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 67 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/init.yml

This file was deleted.

7 changes: 5 additions & 2 deletions doc_template/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
"""Configuration file for the Sphinx documentation builder."""

#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

from datetime import date

# -- Path Setup --------------------------------------------------------------
from os.path import dirname, abspath
from os.path import abspath, dirname
from pathlib import Path
from datetime import date

from aind_smartspim_data_transformation import __version__ as package_version

INSTITUTE_NAME = "Allen Institute for Neural Dynamics"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""
Init internal package
Init SmartSPIM data transformation package
"""
6 changes: 3 additions & 3 deletions src/aind_smartspim_data_transformation/compress/dask_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def log_dashboard_address(
client: the Client instance
login_node_address: the address of the cluster login node
"""
host = client.run_on_scheduler(socket.gethostname)
port = client.scheduler_info()["services"]["dashboard"]
user = os.getenv("USER")
host = client.run_on_scheduler(socket.gethostname) # noqa: F841
port = client.scheduler_info()["services"]["dashboard"] # noqa: F841
user = os.getenv("USER") # noqa: F841
LOGGER.info(
f"To access the dashboard, run the following in "
"a terminal: ssh -L {port}:{host}:{port} {user}@"
Expand Down
24 changes: 16 additions & 8 deletions src/aind_smartspim_data_transformation/compress/png_to_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

import dask
import dask.array as da

# import matplotlib.pyplot as plt
import numpy as np
import pims
import xarray_multiscale
Expand All @@ -33,7 +31,11 @@
from ome_zarr.writer import write_multiscales_metadata
from skimage.io import imread as sk_imread

from aind_smartspim_data_transformation.compress.zarr_utilities import *
from aind_smartspim_data_transformation.compress.zarr_utilities import (
ArrayLike,
PathLike,
pad_array_n_d,
)
from aind_smartspim_data_transformation.compress.zarr_writer import (
BlockedArrayWriter,
)
Expand Down Expand Up @@ -144,16 +146,20 @@ def _compute_scales(
data_shape: Tuple[int, int, int, int, int],
translation: Optional[List[float]] = None,
) -> Tuple[List, List]:
"""Generate the list of coordinate transformations and associated chunk options.
"""
Generate the list of coordinate transformations
and associated chunk options.
Parameters
----------
scale_num_levels: the number of downsampling levels
scale_factor: a tuple of scale factors in each spatial dimension (Z, Y, X)
pixelsizes: a list of pixel sizes in each spatial dimension (Z, Y, X)
chunks: a 5D tuple of integers with size of each chunk dimension (T, C, Z, Y, X)
chunks: a 5D tuple of integers with size of each
chunk dimension (T, C, Z, Y, X)
data_shape: a 5D tuple of the full resolution image's shape
translation: a 5 element list specifying the offset in physical units in each dimension
translation: a 5 element list specifying the offset
in physical units in each dimension
Returns
-------
Expand Down Expand Up @@ -364,7 +370,7 @@ def _get_pyramid_metadata():
"""
return {
"metadata": {
"description": "Downscaling implementation based on the windowed mean of the original array",
"description": "Downscaling using the windowed mean",
"method": "xarray_multiscale.reducers.windowed_mean",
"version": str(xarray_multiscale.__version__),
"args": "[false]",
Expand Down Expand Up @@ -438,7 +444,8 @@ def wavelength_to_hex(wavelength: int) -> int:
"""
# Each wavelength key is the upper bound to a wavelgnth band.
# Wavelengths range from 380-750nm.
# Color map wavelength/hex pairs are generated by sampling along a CIE diagram arc.
# Color map wavelength/hex pairs are generated
# by sampling along a CIE diagram arc.
color_map = {
460: 0x690AFE, # Purple
470: 0x3F2EFE, # Blue-Purple
Expand Down Expand Up @@ -657,6 +664,7 @@ def smartspim_channel_zarr_writer(
# Formatting to 5D block shape
block_shape = ([1] * (5 - len(block_shape))) + block_shape
written_pyramid = []
pyramid_group = None

# Writing multiple levels
for level in range(n_lvls):
Expand Down
3 changes: 2 additions & 1 deletion src/aind_smartspim_data_transformation/io/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ def metadata(self) -> Dict:

zattrs_metadata = ""
zarray_metadata = ""
# Checking inside and outside of folder due to dimension separator "." or "/"
# Checking inside and outside of folder
# due to dimension separator "." or "/"
for path in [data_path, data_path.parent]:
if path.joinpath(".zattrs").exists():
zattrs_metadata = path.joinpath(".zattrs")
Expand Down

0 comments on commit 772780d

Please sign in to comment.