Skip to content

Commit 012124e

Browse files
committed
Updates to package requirements + formatting with black
1 parent 63ef0c9 commit 012124e

File tree

8 files changed

+166
-110
lines changed

8 files changed

+166
-110
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
44
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
55

6+
## [0.9.3] - 2024-01-29
7+
8+
+ Update - DataJoint Elements to install from GitHub instead of PyPI
9+
+ Fix - `element-interface` required during package installation
10+
+ Fix - apply formatting with `black` across the repository
11+
612
## [0.9.2] - 2024-01-10
713

814
+ Fix - Imports and attribute values in notebooks to resolve DataJoint errors
@@ -190,6 +196,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
190196
+ Add - `scan` and `imaging` modules
191197
+ Add - Readers for `ScanImage`, `ScanBox`, `Suite2p`, `CaImAn`
192198

199+
[0.9.3]: https://github.com/datajoint/element-calcium-imaging/releases/tag/0.9.3
193200
[0.9.2]: https://github.com/datajoint/element-calcium-imaging/releases/tag/0.9.2
194201
[0.9.1]: https://github.com/datajoint/element-calcium-imaging/releases/tag/0.9.1
195202
[0.9.0]: https://github.com/datajoint/element-calcium-imaging/releases/tag/0.9.0

element_calcium_imaging/export/nwb/nwb.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,11 @@ def _add_scan_to_nwb(session_key, nwbfile):
192192
name="ImagingPlane",
193193
optical_channel=optical_channel,
194194
imaging_rate=frame_rate,
195-
description=scan_notes
196-
if scan_notes != ""
197-
else f"Imaging plane for field {field_no+1}, channel {channel+1}",
195+
description=(
196+
scan_notes
197+
if scan_notes != ""
198+
else f"Imaging plane for field {field_no+1}, channel {channel+1}"
199+
),
198200
device=device,
199201
excitation_lambda=nan,
200202
indicator="unknown",

element_calcium_imaging/imaging.py

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,30 +1031,40 @@ def make(self, key):
10311031
}
10321032
for fkey, ref_image, ave_img, corr_img, max_img in zip(
10331033
field_keys,
1034-
caiman_dataset.motion_correction["reference_image"].transpose(
1035-
2, 0, 1
1036-
)
1037-
if is3D
1038-
else caiman_dataset.motion_correction["reference_image"][...][
1039-
np.newaxis, ...
1040-
],
1041-
caiman_dataset.motion_correction["average_image"].transpose(2, 0, 1)
1042-
if is3D
1043-
else caiman_dataset.motion_correction["average_image"][...][
1044-
np.newaxis, ...
1045-
],
1046-
caiman_dataset.motion_correction["correlation_image"].transpose(
1047-
2, 0, 1
1048-
)
1049-
if is3D
1050-
else caiman_dataset.motion_correction["correlation_image"][...][
1051-
np.newaxis, ...
1052-
],
1053-
caiman_dataset.motion_correction["max_image"].transpose(2, 0, 1)
1054-
if is3D
1055-
else caiman_dataset.motion_correction["max_image"][...][
1056-
np.newaxis, ...
1057-
],
1034+
(
1035+
caiman_dataset.motion_correction["reference_image"].transpose(
1036+
2, 0, 1
1037+
)
1038+
if is3D
1039+
else caiman_dataset.motion_correction["reference_image"][...][
1040+
np.newaxis, ...
1041+
]
1042+
),
1043+
(
1044+
caiman_dataset.motion_correction["average_image"].transpose(
1045+
2, 0, 1
1046+
)
1047+
if is3D
1048+
else caiman_dataset.motion_correction["average_image"][...][
1049+
np.newaxis, ...
1050+
]
1051+
),
1052+
(
1053+
caiman_dataset.motion_correction["correlation_image"].transpose(
1054+
2, 0, 1
1055+
)
1056+
if is3D
1057+
else caiman_dataset.motion_correction["correlation_image"][...][
1058+
np.newaxis, ...
1059+
]
1060+
),
1061+
(
1062+
caiman_dataset.motion_correction["max_image"].transpose(2, 0, 1)
1063+
if is3D
1064+
else caiman_dataset.motion_correction["max_image"][...][
1065+
np.newaxis, ...
1066+
]
1067+
),
10581068
)
10591069
]
10601070
self.Summary.insert(summary_images)

element_calcium_imaging/imaging_no_curation.py

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -958,30 +958,40 @@ def make(self, key):
958958
}
959959
for fkey, ref_image, ave_img, corr_img, max_img in zip(
960960
field_keys,
961-
caiman_dataset.motion_correction["reference_image"].transpose(
962-
2, 0, 1
963-
)
964-
if is3D
965-
else caiman_dataset.motion_correction["reference_image"][...][
966-
np.newaxis, ...
967-
],
968-
caiman_dataset.motion_correction["average_image"].transpose(2, 0, 1)
969-
if is3D
970-
else caiman_dataset.motion_correction["average_image"][...][
971-
np.newaxis, ...
972-
],
973-
caiman_dataset.motion_correction["correlation_image"].transpose(
974-
2, 0, 1
975-
)
976-
if is3D
977-
else caiman_dataset.motion_correction["correlation_image"][...][
978-
np.newaxis, ...
979-
],
980-
caiman_dataset.motion_correction["max_image"].transpose(2, 0, 1)
981-
if is3D
982-
else caiman_dataset.motion_correction["max_image"][...][
983-
np.newaxis, ...
984-
],
961+
(
962+
caiman_dataset.motion_correction["reference_image"].transpose(
963+
2, 0, 1
964+
)
965+
if is3D
966+
else caiman_dataset.motion_correction["reference_image"][...][
967+
np.newaxis, ...
968+
]
969+
),
970+
(
971+
caiman_dataset.motion_correction["average_image"].transpose(
972+
2, 0, 1
973+
)
974+
if is3D
975+
else caiman_dataset.motion_correction["average_image"][...][
976+
np.newaxis, ...
977+
]
978+
),
979+
(
980+
caiman_dataset.motion_correction["correlation_image"].transpose(
981+
2, 0, 1
982+
)
983+
if is3D
984+
else caiman_dataset.motion_correction["correlation_image"][...][
985+
np.newaxis, ...
986+
]
987+
),
988+
(
989+
caiman_dataset.motion_correction["max_image"].transpose(2, 0, 1)
990+
if is3D
991+
else caiman_dataset.motion_correction["max_image"][...][
992+
np.newaxis, ...
993+
]
994+
),
985995
)
986996
]
987997
self.Summary.insert(summary_images)

element_calcium_imaging/imaging_preprocess.py

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,30 +1244,40 @@ def make(self, key):
12441244
}
12451245
for fkey, ref_image, ave_img, corr_img, max_img in zip(
12461246
field_keys,
1247-
caiman_dataset.motion_correction["reference_image"].transpose(
1248-
2, 0, 1
1249-
)
1250-
if is3D
1251-
else caiman_dataset.motion_correction["reference_image"][...][
1252-
np.newaxis, ...
1253-
],
1254-
caiman_dataset.motion_correction["average_image"].transpose(2, 0, 1)
1255-
if is3D
1256-
else caiman_dataset.motion_correction["average_image"][...][
1257-
np.newaxis, ...
1258-
],
1259-
caiman_dataset.motion_correction["correlation_image"].transpose(
1260-
2, 0, 1
1261-
)
1262-
if is3D
1263-
else caiman_dataset.motion_correction["correlation_image"][...][
1264-
np.newaxis, ...
1265-
],
1266-
caiman_dataset.motion_correction["max_image"].transpose(2, 0, 1)
1267-
if is3D
1268-
else caiman_dataset.motion_correction["max_image"][...][
1269-
np.newaxis, ...
1270-
],
1247+
(
1248+
caiman_dataset.motion_correction["reference_image"].transpose(
1249+
2, 0, 1
1250+
)
1251+
if is3D
1252+
else caiman_dataset.motion_correction["reference_image"][...][
1253+
np.newaxis, ...
1254+
]
1255+
),
1256+
(
1257+
caiman_dataset.motion_correction["average_image"].transpose(
1258+
2, 0, 1
1259+
)
1260+
if is3D
1261+
else caiman_dataset.motion_correction["average_image"][...][
1262+
np.newaxis, ...
1263+
]
1264+
),
1265+
(
1266+
caiman_dataset.motion_correction["correlation_image"].transpose(
1267+
2, 0, 1
1268+
)
1269+
if is3D
1270+
else caiman_dataset.motion_correction["correlation_image"][...][
1271+
np.newaxis, ...
1272+
]
1273+
),
1274+
(
1275+
caiman_dataset.motion_correction["max_image"].transpose(2, 0, 1)
1276+
if is3D
1277+
else caiman_dataset.motion_correction["max_image"][...][
1278+
np.newaxis, ...
1279+
]
1280+
),
12711281
)
12721282
]
12731283
self.Summary.insert(summary_images)

element_calcium_imaging/scan.py

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -330,17 +330,21 @@ def make(self, key):
330330
px_width=scan.field_widths[field_id],
331331
um_height=scan.field_heights_in_microns[field_id],
332332
um_width=scan.field_widths_in_microns[field_id],
333-
field_x=x_zero
334-
+ scan._degrees_to_microns(scan.fields[field_id].x)
335-
if x_zero
336-
else None,
337-
field_y=y_zero
338-
+ scan._degrees_to_microns(scan.fields[field_id].y)
339-
if y_zero
340-
else None,
341-
field_z=z_zero + scan.fields[field_id].depth
342-
if z_zero
343-
else None,
333+
field_x=(
334+
x_zero
335+
+ scan._degrees_to_microns(scan.fields[field_id].x)
336+
if x_zero
337+
else None
338+
),
339+
field_y=(
340+
y_zero
341+
+ scan._degrees_to_microns(scan.fields[field_id].y)
342+
if y_zero
343+
else None
344+
),
345+
field_z=(
346+
z_zero + scan.fields[field_id].depth if z_zero else None
347+
),
344348
delay_image=scan.field_offsets[field_id],
345349
roi=scan.field_rois[field_id][0],
346350
)
@@ -359,9 +363,11 @@ def make(self, key):
359363
um_width=getattr(scan, "image_width_in_microns", None),
360364
field_x=x_zero if x_zero else None,
361365
field_y=y_zero if y_zero else None,
362-
field_z=z_zero + scan.scanning_depths[plane_idx]
363-
if z_zero
364-
else None,
366+
field_z=(
367+
z_zero + scan.scanning_depths[plane_idx]
368+
if z_zero
369+
else None
370+
),
365371
delay_image=scan.field_offsets[plane_idx],
366372
)
367373
for plane_idx in range(scan.num_scanning_depths)
@@ -387,9 +393,11 @@ def make(self, key):
387393
self.insert1(
388394
dict(
389395
key,
390-
nfields=sbx_meta["num_fields"]
391-
if is_multiROI
392-
else sbx_meta["num_planes"],
396+
nfields=(
397+
sbx_meta["num_fields"]
398+
if is_multiROI
399+
else sbx_meta["num_planes"]
400+
),
393401
nchannels=sbx_meta["num_channels"],
394402
nframes=sbx_meta["num_frames"],
395403
ndepths=sbx_meta["num_planes"],
@@ -412,12 +420,16 @@ def make(self, key):
412420
field_idx=plane_idx,
413421
px_height=px_height,
414422
px_width=px_width,
415-
um_height=px_height * sbx_meta["um_per_pixel_y"]
416-
if sbx_meta["um_per_pixel_y"]
417-
else None,
418-
um_width=px_width * sbx_meta["um_per_pixel_x"]
419-
if sbx_meta["um_per_pixel_x"]
420-
else None,
423+
um_height=(
424+
px_height * sbx_meta["um_per_pixel_y"]
425+
if sbx_meta["um_per_pixel_y"]
426+
else None
427+
),
428+
um_width=(
429+
px_width * sbx_meta["um_per_pixel_x"]
430+
if sbx_meta["um_per_pixel_x"]
431+
else None
432+
),
421433
field_x=x_zero,
422434
field_y=y_zero,
423435
field_z=z_zero + sbx_meta["etl_pos"][plane_idx],
@@ -462,9 +474,11 @@ def estimate_nd2_scan_duration(nd2_scan_obj):
462474
scan_datetime = nd2_file.text_info["date"]
463475
scan_datetime = datetime.strptime(
464476
scan_datetime,
465-
"%m/%d/%Y %H:%M:%S %p"
466-
if re.search(("AM|PM"), scan_datetime)
467-
else "%m/%d/%Y %H:%M:%S",
477+
(
478+
"%m/%d/%Y %H:%M:%S %p"
479+
if re.search(("AM|PM"), scan_datetime)
480+
else "%m/%d/%Y %H:%M:%S"
481+
),
468482
)
469483
scan_datetime = datetime.strftime(scan_datetime, "%Y-%m-%d %H:%M:%S")
470484
except: # noqa: E722
@@ -551,9 +565,11 @@ def estimate_nd2_scan_duration(nd2_scan_obj):
551565
um_width=PVScan_info["width_in_um"],
552566
field_x=PVScan_info["fieldX"],
553567
field_y=PVScan_info["fieldY"],
554-
field_z=PVScan_info["fieldZ"]
555-
if PVScan_info["num_planes"] == 1
556-
else PVScan_info["fieldZ"][plane_idx],
568+
field_z=(
569+
PVScan_info["fieldZ"]
570+
if PVScan_info["num_planes"] == 1
571+
else PVScan_info["fieldZ"][plane_idx]
572+
),
557573
)
558574
for plane_idx in range(PVScan_info["num_planes"])
559575
)

element_calcium_imaging/version.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Package metadata."""
2-
__version__ = "0.9.2"
2+
3+
__version__ = "0.9.3"

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@
3838
"ipykernel>=6.0.1",
3939
"ipywidgets",
4040
"plotly",
41+
"element-interface @ git+https://github.com/datajoint/element-interface.git",
4142
],
4243
extras_require={
4344
"caiman_requirements": [caiman_requirements],
4445
"caiman": ["caiman @ git+https://github.com/datajoint/CaImAn.git"],
4546
"elements": [
46-
"element-animal>=0.1.8",
47-
"element-event>=0.2.3",
48-
"element-interface>=0.6.0",
49-
"element-lab>=0.3.0",
50-
"element-session>=0.1.5",
47+
"element-animal @ git+https://github.com/datajoint/element-animal.git",
48+
"element-event @ git+https://github.com/datajoint/element-event.git",
49+
"element-lab @ git+https://github.com/datajoint/element-lab.git",
50+
"element-session @ git+https://github.com/datajoint/element-session.git",
5151
],
5252
"extract": ["matlabengine", "scipy"],
5353
"nd2": ["nd2"],

0 commit comments

Comments
 (0)