dynamicroutingtask's People
dynamicroutingtask's Issues
`subjectName` from hdf5 path vs. contents
Hey Sam,
Would it be a problem to revert back to the commented-out line for extracting subjectName
below?
class DynRoutData:
...
def loadBehavData(self,filePath):
self.behavDataPath = filePath
with h5py.File(self.behavDataPath,'r') as d:
# self.subjectName = d['subjectName'][()]
self.subjectName = re.search('.*_([0-9]{6})_',os.path.basename(self.behavDataPath)).group(1)
...
I'm trying to use the class with hdf5s on s3 as follows:
import io
import upath # 3rd party package for opening files from cloud storage
obj = DynRoutData()
file = io.BytesIO(
upath.UPath(
's3://aind-ephys-data/ecephys_670248_2023-08-03_12-04-15/behavior/DynamicRouting1_670248_20230803_123154.hdf5'
).read_bytes()
)
obj.loadBehavData(file)
Which works fine for opening via h5py.File()
, but can't be used as a path to extract the subject id.
If it's preferable to get the subject from the filename, perhaps we could do something like this:
def loadBehavData(self,filePath, fileBytes=None):
self.behavDataPath = filePath
with h5py.File(fileBytes or self.behavDataPath,'r') as d:
# self.subjectName = d['subjectName'][()]
self.subjectName = re.search('.*_([0-9]{6})_',os.path.basename(self.behavDataPath)).group(1)
...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.