diff --git a/.github/workflows/init.yml b/.github/workflows/init.yml deleted file mode 100644 index 0336013..0000000 --- a/.github/workflows/init.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Workflow runs only once when the template is first used. -# File can be safely deleted after repo is initialized. -name: Initialize repository -on: - push: - branches: - - main - -jobs: - initialize-package: - name: Initialize the package - if: ${{github.event.repository.name != 'aind-library-template'}} - runs-on: ubuntu-latest - env: - REPO_NAME: ${{ github.event.repository.name }} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Rename package - run: | - pkg_name=$(echo "${REPO_NAME}" | tr - _) - current_description='description = "Prints messages to stdout. Simple boilerplate for libraries."' - new_description='description = "Generated from aind-library-template"' - readme_description='Template for a minimal, basic repository for an AIND library.' - new_readme_description='Generated from aind-library-template' - echo "Package Name ${pkg_name}" - mkdir src/${pkg_name} - touch src/${pkg_name}/__init__.py - echo '"""Init package"""' >> src/${pkg_name}/__init__.py - echo '__version__ = "0.0.0"' >> src/${pkg_name}/__init__.py - sed -i "s/aind_library_template/${pkg_name}/" pyproject.toml - sed -i "s/aind-library-template/${REPO_NAME}/" pyproject.toml - sed -i "s/aind_library_template/${pkg_name}/" doc_template/source/conf.py - sed -i "s/${current_description}/${new_description}/" pyproject.toml - sed -i "/pandas/d" pyproject.toml - sed -i "s/aind-library-template/${REPO_NAME}/" README.md - sed -i "s/${readme_description}/${new_readme_description}/" README.md - - name: Commit changes - uses: EndBug/add-and-commit@v9 - with: - default_author: github_actions - message: "ci: version bump [skip actions]" - add: '["pyproject.toml", "README.md", "src/*", "doc_template/source/conf.py"]' - remove: '["-r src/aind_library_template", "tests/test_message_handler.py"]' - - name: Add first tag - run: | - git tag v0.0.0 - git push origin v0.0.0 - - name: Disable workflow - run: | - gh workflow disable -R $GITHUB_REPOSITORY "${{ github.workflow }}" diff --git a/doc_template/source/conf.py b/doc_template/source/conf.py index 9f9c46c..d602401 100644 --- a/doc_template/source/conf.py +++ b/doc_template/source/conf.py @@ -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" diff --git a/src/aind_smartspim_data_transformation/compress/__init__.py b/src/aind_smartspim_data_transformation/compress/__init__.py index f8926e0..a3c9cb6 100644 --- a/src/aind_smartspim_data_transformation/compress/__init__.py +++ b/src/aind_smartspim_data_transformation/compress/__init__.py @@ -1,3 +1,3 @@ """ -Init internal package +Init SmartSPIM data transformation package """ diff --git a/src/aind_smartspim_data_transformation/compress/dask_utils.py b/src/aind_smartspim_data_transformation/compress/dask_utils.py index 764b5a7..6f70187 100644 --- a/src/aind_smartspim_data_transformation/compress/dask_utils.py +++ b/src/aind_smartspim_data_transformation/compress/dask_utils.py @@ -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}@" diff --git a/src/aind_smartspim_data_transformation/compress/png_to_zarr.py b/src/aind_smartspim_data_transformation/compress/png_to_zarr.py index 602bfa1..5758d76 100644 --- a/src/aind_smartspim_data_transformation/compress/png_to_zarr.py +++ b/src/aind_smartspim_data_transformation/compress/png_to_zarr.py @@ -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 @@ -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, ) @@ -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 ------- @@ -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]", @@ -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 @@ -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): diff --git a/src/aind_smartspim_data_transformation/io/_io.py b/src/aind_smartspim_data_transformation/io/_io.py index 20a9f81..6effab0 100644 --- a/src/aind_smartspim_data_transformation/io/_io.py +++ b/src/aind_smartspim_data_transformation/io/_io.py @@ -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")