Skip to content

Commit

Permalink
add ruff, redo deps v0.12.3
Browse files Browse the repository at this point in the history
  • Loading branch information
kjohnsen committed Dec 1, 2023
1 parent ffc47f4 commit f9baeac
Show file tree
Hide file tree
Showing 8 changed files with 368 additions and 562 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ my_function(a, b='B'):
```

## Style
We will use Black formatting. The easiest way is to enable Black as the formatter in
your IDE with auto-formatting on save.
We will use Black-style formatting, as implemented (faster) by Ruff.
The easiest way is to enable Ruff as the formatter in your IDE with auto-formatting on save.

## Linting
I was going to lint using flake8 but then I realized, this is a small research code package! We don't need super pretty, consistent code. Just try to follow Python conventions and use Black.
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

[![Tests](https://github.com/kjohnsen/cleosim/actions/workflows/test.yml/badge.svg)](https://github.com/kjohnsen/cleosim/actions/workflows/test.yml)
[![Documentation Status](https://readthedocs.org/projects/cleosim/badge/?version=latest)](https://cleosim.readthedocs.io/en/latest/?badge=latest)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)


<h1>
Expand Down Expand Up @@ -80,9 +81,7 @@ The `ldsCtrlEst` library implements adaptive linear dynamical system-based contr
</p>

### 📃 Publications
[**Cleo: A testbed for bridging model and experiment by
simulating closed-loop stimulation, electrode recording,
and optophysiology**](https://www.biorxiv.org/content/10.1101/2023.01.27.525963)<br>
[**Cleo: A testbed for bridging model and experiment by simulating closed-loop stimulation, electrode recording, and optophysiology**](https://www.biorxiv.org/content/10.1101/2023.01.27.525963)<br>
K.A. Johnsen, N.A. Cruzado, Z.C. Menard, A.A. Willats, A.S. Charles, and C.J. Rozell. *bioRxiv*, 2023.

[**CLOC Tools: A Library of Tools for Closed-Loop Neuroscience**](https://github.com/cloctools/tools-for-neuro-control-manuscript)<br>
Expand Down
2 changes: 1 addition & 1 deletion cleo/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def assign_coords_grid_rect_prism(
z = np.linspace(zlim[0], zlim[1], shape[2])

x, y, z = np.meshgrid(x, y, z, indexing="ij")
assign_xyz(neuron_group, x, y, z)
assign_xyz(neuron_group, x, y, z, unit=unit)


def assign_coords_rand_rect_prism(
Expand Down
4 changes: 1 addition & 3 deletions cleo/light/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ def viz_params(
x, y, z = xyz_from_rθz(r, theta, zc, coords, end)
density_factor = 3
cyl_vol = np.pi * r_thresh**2 * zc_thresh
markersize_um = ((cyl_vol / n_points_per_source * density_factor)) ** (
1 / 3
) / um
markersize_um = (cyl_vol / n_points_per_source * density_factor) ** (1 / 3) / um
intensity_scale = (1e3 / n_points_per_source) ** (1 / 3)
return coords_from_xyz(x, y, z), markersize_um, intensity_scale

Expand Down
8 changes: 3 additions & 5 deletions cleo/light/two_photon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import numpy as np
from attrs import define
from brian2 import Quantity
from brian2.units import um, nmeter
from brian2.units import nmeter, um
from nptyping import NDArray

from cleo.coords import concat_coords, coords_from_ng, coords_from_xyz
from cleo.light import LightModel, Light
from cleo.light import Light, LightModel
from cleo.utilities import uniform_cylinder_rθz, xyz_from_rθz


Expand Down Expand Up @@ -59,9 +59,7 @@ def viz_params(
# m x n x 3
density_factor = 3
cyl_vol = np.pi * r_thresh**2 * zc_thresh
markersize_um = ((cyl_vol / n_points_per_source * density_factor)) ** (
1 / 3
) / um
markersize_um = (cyl_vol / n_points_per_source * density_factor) ** (1 / 3) / um
intensity_scale = (1000 / n_points_per_source) ** (1 / 3)
return coords_from_xyz(x, y, z), markersize_um, intensity_scale

Expand Down
17 changes: 8 additions & 9 deletions cleo/utilities.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
"""Assorted utilities for developers."""
import warnings
from collections.abc import MutableMapping

from matplotlib import pyplot as plt

from brian2 import np, second, Quantity
from brian2.groups.group import get_dtype
import neo
import quantities as pq
from brian2 import Quantity, np, second
from brian2.equations.equations import (
Equations,
DIFFERENTIAL_EQUATION,
SUBEXPRESSION,
PARAMETER,
SUBEXPRESSION,
Equations,
)
import neo
import quantities as pq

from brian2.groups.group import get_dtype
from matplotlib import pyplot as plt

rng = np.random.default_rng()
"""supposed to be the central random number generator, but not yet used everywhere"""
Expand Down
Loading

0 comments on commit f9baeac

Please sign in to comment.