Skip to content

Commit

Permalink
add some type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Feb 19, 2024
1 parent 89b389d commit d05e906
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions neurodesign/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def _generate_order_items(probabilities, items):
def iti(
ntrials: int,
model: str,
min: float = None,
mean: float = None,
max: float = None,
min: float | None = None,
mean: float | None = None,
max: float | None = None,
lam=None,
resolution: float = 0.1,
seed: int | None = 1234,
Expand Down
2 changes: 1 addition & 1 deletion neurodesign/msequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self):
# read in taps file and count
self.tapsfnc()

def GenMseq(self, mLen, stimtypeno, seed):
def GenMseq(self, mLen: int, stimtypeno: int, seed: int):
"""Generate a random msequence given the length of the desired sequence \
and the number of different values.
Expand Down
9 changes: 6 additions & 3 deletions neurodesign/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
Table,
)

from neurodesign import Optimisation

plt.switch_backend("agg")


def make_report(population, outfile: str | Path = "NeuroDesign.pdf"):
def make_report(population: Optimisation, outfile: str | Path = "NeuroDesign.pdf"):
"""Create a report of a finished design optimisation."""
if not isinstance(population.cov, np.ndarray):
population.evaluate()
Expand Down Expand Up @@ -179,15 +181,16 @@ def _form_xo_reader(imgdata):


class PdfImage(Flowable):
def __init__(self, img_data, width=200, height=200):
def __init__(self, img_data, width: int = 200, height: int = 200):
self.img_width = width
self.img_height = height
self.img_data = img_data

def wrap(self, width, height):
def wrap(self):
return self.img_width, self.img_height

def drawOn(self, canv, x, y, _sW=0):
# TODO TA_CENTER TA_RIGHT TA_LEFT are undefined
if _sW > 0 and hasattr(self, "hAlign"):
a = self.hAlign
if a in ("CENTER", "CENTRE", TA_CENTER):
Expand Down

0 comments on commit d05e906

Please sign in to comment.