Skip to content

Instantly share code, notes, and snippets.

View neuromusic's full-sized avatar
🏜️
Living the dream

Justin Kiggins neuromusic

🏜️
Living the dream
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@neuromusic
neuromusic / make_bad_nwb_file.py
Created December 20, 2017 23:34
demonstration of pynwb issue #146
## create minimal set of objects for defining a dF/F object
from pynwb.ophys import TwoPhotonSeries, RoiResponseSeries, DfOverF, Fluorescence, PlaneSegmentation, \
ImageSegmentation, OpticalChannel, ImagingPlane, ROI
from pynwb.image import ImageSeries
w, h = 5, 5
img_mask = [[0 for x in range(w)] for y in range(h)]
w, h = 5, 2
pix_mask = [[0 for x in range(w)] for y in range(h)]
@neuromusic
neuromusic / timeseries_to_xarray.py
Created November 19, 2017 21:42
pynwb timeseries to xarray dataarray
def timeseries_to_xarray(time_series):
attrs = ts.fields.copy()
data = attrs.pop('data').value
timestamps = attrs.pop('timestamps').value
for k,v in attrs.iteritems():
# replace any links with their name
try:
attrs[k] = v.name
# NOTE: `dataset` is an internal object for data ingest & time alignment
session_start_time = dataset.pkl['startdatetime']
roi_masks = dataset.get_roi_mask_array()
max_projection = dataset.get_max_projection()
dFF, dFF_t = dataset.get_dff_traces()
NA = 'THIS REQUIRED ATTRIBUTE INTENTIONALLY LEFT BLANK.'
@neuromusic
neuromusic / ophys_example.py
Last active September 25, 2017 21:05
saving dF/F traces with pynwb
# NOTE: `dataset` is an internal object for data ingest & time alignment
session_start_time = dataset.pkl['startdatetime']
roi_masks = dataset.get_roi_mask_array()
max_projection = dataset.get_max_projection()
dFF, dFF_t = dataset.get_dff_traces()
NA = 'THIS REQUIRED ATTRIBUTE INTENTIONALLY LEFT BLANK.'
@neuromusic
neuromusic / xarray+neurophysiology.ipynb
Created August 24, 2017 18:43
example using xarray for neurophysiology
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.