Skip to content

Commit

Permalink
setting up CI for the repo (#33)
Browse files Browse the repository at this point in the history
* making test_plots.py independent from ONE

* removing outdated examples

* analysis folder added to gitignore

* more ruffing

* CI adjust

* CI adjust 2

* CI adjust 3

* fixing requirements to include develop branch of ibllib and iblrig

* and now correctly formatted

* adding data from kcenia, changing stimOn_times key. Very unclear why as of now

* removed python 3.11

* fix test plots import base tests

* CI for unit tests

* ruff

---------

Co-authored-by: owinter <olivier.winter@hotmail.fr>
  • Loading branch information
grg2rsr and oliche authored Dec 4, 2024
1 parent 9c4568a commit f0280f7
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 707 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ jobs:
name: ruff format
with:
args: 'format --check'
build:
runs-on: ubuntu-latest
tests:
name: unit tests (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 6
matrix:
python-version: ["3.10"]

os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install deps
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,5 @@ cython_debug/
#.idea/

# local scripts
src/local
src/local
src/analysis
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ibllib
ibllib @ git+https://github.com/int-brain-lab/ibllib@develop
numpy
matplotlib
pytest
scipy
pandera
pandera
31 changes: 0 additions & 31 deletions src/examples/example_raw_npdata_plot.py

This file was deleted.

274 changes: 0 additions & 274 deletions src/examples/photometry_exploration.ipynb

This file was deleted.

227 changes: 0 additions & 227 deletions src/examples/photometry_exploration_kcenia.ipynb

This file was deleted.

7 changes: 0 additions & 7 deletions src/gui/rawdata_visualizer.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
import sys
import pandas as pd
import matplotlib.pyplot as plt
from PyQt5.QtWidgets import (
QApplication,
QWidget,
QVBoxLayout,
QHBoxLayout,
QPushButton,
QFileDialog,
QTableWidget,
QTableWidgetItem,
QComboBox,
QGridLayout,
QLineEdit,
)
from PyQt5.QtCore import Qt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5 import NavigationToolbar2QT as NavigationToolbar
from pydantic.v1 import NoneStr

from iblphotometry.io import from_raw_neurophotometrics
import iblphotometry.plots as plots

import iblphotometry.preprocessing as ffpr
import numpy as np
from matplotlib.colorbar import Colorbar


class DataFrameVisualizerApp(QWidget):
Expand Down
4 changes: 2 additions & 2 deletions src/iblphotometry/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ def __init__(self, one, verbose=False):
self.one = one
self.verbose = verbose

def load_photometry_data(self, eid=None, pid=None, rename=True) -> nap.TsdFrame:
def load_photometry_data(self, eid=None, pid=None, rename=True) -> pd.DataFrame:
if pid is not None:
raise NotImplementedError
# return self._load_data_from_pid(pid)

if eid is not None:
return self._load_data_from_eid(eid, rename=rename)

def _load_data_from_eid(self, eid, rename=True) -> nap.TsdFrame:
def _load_data_from_eid(self, eid, rename=True) -> pd.DataFrame:
raw_photometry_df = self.one.load_dataset(eid, 'photometry.signal.pqt')
locations_df = self.one.load_dataset(eid, 'photometryROI.locations.pqt')
read_config = dict(
Expand Down
4 changes: 0 additions & 4 deletions src/iblphotometry/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

import numpy as np
import pandas as pd
from iblphotometry.helpers import z, filt

# from ibldsp.utils import WindowGenerator
from iblphotometry import sliding_operations
from iblphotometry import bleach_corrections
from iblphotometry.outlier_detection import remove_spikes
from iblphotometry.bleach_corrections import lowpass_bleachcorrect, isosbestic_correct
from iblphotometry.sliding_operations import sliding_mad
Expand All @@ -15,7 +12,6 @@
from iblphotometry.helpers import zscore

import logging
from copy import copy

logger = logging.getLogger()

Expand Down
4 changes: 2 additions & 2 deletions src/iblphotometry/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

PSTH_EVENTS = {
'feedback_times': 'Feedback',
'stimOnTrigger_times': 'Stim on',
'stimOn_times': 'Stim on',
'firstMovement_times': 'First move',
}

Expand Down Expand Up @@ -209,7 +209,7 @@ def plot_trialsort_psth(self):
fig.tight_layout()
return fig, axs

def plot_processed_trialtick(self, event_key='stimOnTrigger_times'):
def plot_processed_trialtick(self, event_key='stimOn_times'):
fig, ax = plt.subplots(1, 1)
plt.figure(figsize=(10, 6))
events = self.trials[event_key]
Expand Down
2 changes: 2 additions & 0 deletions src/iblphotometry_tests/base_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def get_fixtures() -> dict:
/ session_folder
/ Path('raw_photometry_data/_neurophotometrics_fpData.raw.pqt'),
'raw_neurophotometrics_csv': data_folder / 'raw_photometry.csv',
'raw_kcenia_pqt': data_folder / 'raw_photometry.pqt',
'trials_table_kcenia_pqt': data_folder / '_ibl_trials.table.pqt',
'trials_table_pqt': data_folder / session_folder / 'alf/_ibl_trials.table.pqt',
}

Expand Down
Binary file not shown.
Binary file added src/iblphotometry_tests/data/raw_photometry.pqt
Binary file not shown.
1 change: 0 additions & 1 deletion src/iblphotometry_tests/test_loaders.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import unittest
import iblphotometry.io as fio
import numpy as np
from iblphotometry_tests.base_tests import PhotometryDataTestCase
Expand Down
1 change: 0 additions & 1 deletion src/iblphotometry_tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import unittest
import iblphotometry.io as fio
import iblphotometry.metrics as metrics
import pandas as pd
Expand Down
1 change: 0 additions & 1 deletion src/iblphotometry_tests/test_pipelines.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import unittest
from pathlib import Path
import iblphotometry.io as fio
from iblphotometry.pipelines import (
Expand Down
Loading

0 comments on commit f0280f7

Please sign in to comment.