Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes and adjust pre-commit #22

Merged
merged 8 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/workflows/codespell.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Full Tests
on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: true

jobs:
run:
Expand Down
21 changes: 15 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@ repos:
rev: v4.6.0
hooks:
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
exclude: ^docs/

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
hooks:
- id: ruff
args: [ --fix ]

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli
26 changes: 18 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools >= 61.0"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
Expand All @@ -23,8 +23,7 @@ keywords = ["leifer", "C elegans", "NWB", "conversion", "open data", "microscopy

classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: BSD License",
"Intended Audience :: Developers",
"Operating System :: Microsoft :: Windows",
Expand All @@ -42,7 +41,7 @@ dependencies = [

[tool.black]
line-length = 120
target-version = ["py310", "py311"]
target-version = ["py312"]
include = '\.pyi?$'
extend-exclude = '''
/(
Expand All @@ -61,7 +60,18 @@ extend-exclude = '''
)/
'''

[tool.isort]
profile = "black"
reverse_relative = true
known_first_party = ["leifer_lab_to_nwb"]
[tool.ruff]
exclude = [
"*/__init__.py"
]

[tool.ruff.lint.isort]
relative-imports-order = "closest-to-furthest"
known-first-party = ["leifer_lab_to_nwb"]



[tool.codespell]
skip = '.git*,*.pdf,*.css'
check-hidden = true
ignore-words-list = 'assertin' # Should be able to remove on next codespell release
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import copy
from typing import Union

import ndx_multichannel_volume
import neuroconv
Expand Down
2 changes: 0 additions & 2 deletions src/leifer_lab_to_nwb/randi_nature_2023/convert_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import pathlib
import warnings

import pandas
import pynwb
from dateutil import tz

from leifer_lab_to_nwb.randi_nature_2023 import RandiNature2023Converter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def __init__(self, *, pumpprobe_folder_path: str | pathlib.Path) -> None:

def add_to_nwbfile(self, nwbfile: pynwb.NWBFile, metadata: dict):
# Plane depths
volt_per_um = 0.125 # Hardcoded value by the lab
depth_in_um_per_pixel = 0.42 # Hardcoded value by the lab
# volt_per_um = 0.125 # Hardcoded value by the lab
# depth_in_um_per_pixel = 0.42 # Hardcoded value by the lab

# zScan contents

Expand Down Expand Up @@ -73,18 +73,18 @@ def add_to_nwbfile(self, nwbfile: pynwb.NWBFile, metadata: dict):
# TODO: could include as a simple TimeSeries with same timestamps as volumetric photon series but values 1, -1

# Extra frameSynchronous information
frame_sync_to_nwb_names = {
"Piezo position (V)": "piezo_position_in_volume",
"Piezo direction (+-1)": "piezo_direction",
"Ludl X": "ludl_x",
"Ludl Y": "ludl_y",
}
frame_sync_scanning_column_descriptions = {
"piezo_position_in_volume": "",
"piezo_direction": "",
"ludl_x": "",
"ludl_y": "",
}
# frame_sync_to_nwb_names = {
# "Piezo position (V)": "piezo_position_in_volume",
# "Piezo direction (+-1)": "piezo_direction",
# "Ludl X": "ludl_x",
# "Ludl Y": "ludl_y",
# }
# frame_sync_scanning_column_descriptions = {
# "piezo_position_in_volume": "",
# "piezo_direction": "",
# "ludl_x": "",
# "ludl_y": "",
# }

# TODO: unpack frameSync content, likely as several TimeSeries with same timestamps as volumetric photon series
# Will require some reshaping into the volumes since these are flattened frames
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import json
import pathlib
import shutil
from typing import Literal

import ndx_microscopy
import neuroconv
import numpy
import pandas
import pynwb


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pathlib
from typing import Union

import ndx_microscopy
import ndx_patterned_ogen
import neuroconv
import numpy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pathlib
import shutil
from typing import Literal

import ndx_microscopy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,11 @@
import pathlib
import warnings

import pandas
import pynwb
from dateutil import tz
from pynwb.testing.mock.file import mock_NWBFile

from leifer_lab_to_nwb.randi_nature_2023 import RandiNature2023Converter
from leifer_lab_to_nwb.randi_nature_2023.interfaces import (
ExtraOphysMetadataInterface,
NeuroPALImagingInterface,
NeuroPALSegmentationInterface,
OptogeneticStimulationInterface,
PumpProbeImagingInterface,
PumpProbeSegmentationInterface,
)

# Define base folder of source data
# Change these as needed on new systems
Expand Down