Saravanan666/pypi-org huggingface dataset:
Package: ndvector
Aboutndvectoris yet another vector math library for Python3. Where numpy focuses
on everything including the kitchen sink, ndvector is intended to provide a
simple, pythonic, object oriented API for vector math in n dimensions.LicenseApache License 2.0 (see LICENSE)Requirementspython >= 3.5UsageUsage attempts to be about what you expect. Simply import the library, create
Point and Vector objects, and do math with them.fromn_dimensionimportVectorv1=Vector(1.0,0.0)v2=Vector(-1.0,1.0)v3=v1+v2print(v3)# => Vector ‹0.0, 1.0›APIGiven:- s a scalar (float)

- p, p# are instances of Point

- v, v# are instances of VectorClassPoint:- constructor - create a Point from one or more float parameters, a tuple
	of floats, or a list of floats

- properties:

	- dimension - the dimension of the Point

- operators:

	- 'p + v' addition of a Vector to a Point to get the Point at the tip of
		the Vector if the tail of the vector is moved to the Point

	- 'p1 - p2' subtraction of a Point from a Point to get the Vector between
		the Points

	- 'p1 == p2' equality (See Note 1)

	- 'p1 != p2' not equality (See Note 1)ClassVector:- constructor - create a Vector from one or more float parameters, a tuple
	of floats, or a list of floats

- properties:
	- dimension - the dimension of the vector
	- magnitude - the magnitude of the vector

- operators

	- 'v1 + v2' vector addition

	- 'v1 - v2' vector subtraction

	- 'v1 * v2' scalar aka dot product (v1 * v2 => scalar)

	- 'v * s' scale vector

	- 'v1 @ v2' vector aka cross product (v1 * v2 => vector) (See Note 2)

	- 'v1 == v2' equality (See Note 1)

	- 'v1 != v2' not equality (See Note 1)

- methods

	- angle() - find the angle in radians between the vector and another vector

	- normalize() - find a unit vector with the same direction as the vectorNotestesting for equality when floats are involved is tricky. n_dimension
considers two floats to be equal if the absolute value of their difference
is less than a certain amount; currently 0.000001 seems to work well. This
may be refined after more testingonly implemented for Vectors of dimension three (3)TestingTesting is done usingtoxandpytest. Seehttps://tox.readthedocs.io/en/latest/for information about installing tox.
Run the tests by cloning the source repository, changing into the local
working directory, and invokingtox.gitclonehttps://github.com/tkegan/n_dimension.gitcdn_dimension
toxTo DoCreate better API documentationInvestigate accelerated performance by moving some functionality to compiled code but only if the pure python implementation can be kept as a fallbackContributeI welcome pull requests against the GitHub repository. If extending the API, please include tests. I will not merge changes to the API until tests are in place and passing.
Package: ndx-bipolar-referencing
ndx-bipolar-referencing Extension for NWB:NStructure for storing the bipolar schema of a recording in an NWB file.python installation$pipinstallndx-bipolar-referencingpython usagefrompynwbimportNWBHDF5IO,NWBFilefrompynwb.fileimportDynamicTable,DynamicTableRegionfromdatetimeimportdatetimefromndx_bipolar_referencingimportEcephysExtfrompynwb.ecephysimportElectricalSeriesimportnumpyasnpnwbfile=NWBFile('description','id',datetime.now().astimezone())device=nwbfile.create_device('device_name')electrode_group=nwbfile.create_electrode_group('electrode_group','desc','loc',device=device)for_inrange(20):nwbfile.add_electrode(np.nan,np.nan,np.nan,np.nan,'loc','filt',electrode_group)anode_electrodes=DynamicTableRegion('anode',np.arange(0,20,2),'desc',nwbfile.electrodes)cathode_electrodes=DynamicTableRegion('cathode',np.arange(1,20,2),'desc',nwbfile.electrodes)bipolar_reference_scheme=DynamicTable(name='bipolar_reference_scheme',description='desc',columns=[anode_electrodes,cathode_electrodes])ecephys_ext=EcephysExt(bipolar_reference_scheme=bipolar_reference_scheme)nwbfile.add_lab_meta_data(ecephys_ext)bipolar_scheme=DynamicTableRegion(name='electrodes',data=np.arange(0,10),description='desc',table=nwbfile.lab_meta_data['extracellular_electrophysiology_extensions'].bipolar_reference_scheme)ec_series=ElectricalSeries(name='test_ec_series',description='desc',data=np.random.rand(100,10),rate=1000.,electrodes=bipolar_scheme)nwbfile.add_acquisition(ec_series)withNWBHDF5IO('test_nwb.nwb','w')asio:io.write(nwbfile)withNWBHDF5IO('test_nwb.nwb','r',load_namespaces=True)asio:nwbfile=io.read()print(nwbfile.acquisition['test_ec_series'].electrodes.table['anode'].data)
Package: ndx-bipolar-scheme
ndx-bipolar-scheme Extension for NWBStructure for storing the bipolar schema of a recording in an NWB file.python installation$pipinstallndx-bipolar-schemepython usagefrompynwbimportNWBHDF5IO,NWBFilefrompynwb.fileimportDynamicTableRegionfromdatetimeimportdatetimefromndx_bipolar_schemeimportBipolarSchemeTable,EcephysExtfrompynwb.ecephysimportElectricalSeriesimportnumpyasnpnwbfile=NWBFile('description','id',datetime.now().astimezone())device=nwbfile.create_device('device_name')electrode_group=nwbfile.create_electrode_group('electrode_group','desc','loc',device=device)foriinnp.arange(20.):nwbfile.add_electrode(i,i,i,np.nan,'loc','filt',electrode_group)bipolar_scheme_table=BipolarSchemeTable(name='bipolar_scheme_table',description='desc')bipolar_scheme_table.add_row(anodes=[0],cathodes=[1])bipolar_scheme_table.add_row(anodes=[0,1],cathodes=[2,3])bipolar_scheme_table.add_row(anodes=[0,1],cathodes=[2])bipolar_scheme_table.anodes.table=nwbfile.electrodesbipolar_scheme_table.cathodes.table=nwbfile.electrodesbipolar_scheme_region=DynamicTableRegion(name='electrodes',data=np.arange(0,3),description='desc',table=bipolar_scheme_table)ec_series=ElectricalSeries(name='test_ec_series',description='desc',data=np.random.rand(100,3),rate=1000.,electrodes=bipolar_scheme_region)nwbfile.add_acquisition(ec_series)ecephys_ext=EcephysExt(name='ecephys_ext')ecephys_ext.bipolar_scheme_table=bipolar_scheme_tablenwbfile.add_lab_meta_data(ecephys_ext)withNWBHDF5IO('test_nwb.nwb','w')asio:io.write(nwbfile)withNWBHDF5IO('test_nwb.nwb','r',load_namespaces=True)asio:nwbfile=io.read()print(nwbfile.acquisition['test_ec_series'].electrodes.table['anodes'][2]['x'])
Package: ndx-dandi-icephys
ndx-dandi-icephys extension for NWB:NExtension of thelab_meta_datafield.Python InstallationPython UsagePython Installationpipinstallndx-dandi-icephysPython UsagefromdatetimeimportdatetimefrompynwbimportNWBFile,NWBHDF5IOfromndx_dandi_icephysimportDandiIcephysMetadatanwb=NWBFile('session_description','identifier',datetime.now().astimezone())# Creates LabMetaData containerlab_metadata=DandiIcephysMetadata(cell_id='cell_id',tissue_sample_id='tissue_sample_id',)# Add to filenwb.add_lab_meta_data(lab_metadata)# Write nwb filewithNWBHDF5IO('test_labmetadata.nwb','w')asio:io.write(nwb)# Read nwb file and check its contentwithNWBHDF5IO('test_labmetadata.nwb','r',load_namespaces=True)asio:nwb=io.read()print(nwb.lab_meta_data['DandiIcephysMetadata'])
Package: ndx-ecog
ndx-ecog Extension for NWB:NAuthor: Ben DichterThere are three data types,Surface,CorticalSurfaces, andECoGSubject.CorticalSurfacesis simply a group (like a folder) to putSurfaceobjects into.Surfaceholds surface mesh data (vertices and triangular faces) for sections of cortex.ECoGSubjectis an extension ofSubjectthat allows you to add theCorticalSurfacesobject to/general/subject.Usagepythoninstall:pipinstallndx_ecogwrite:importpynwbfromndx_ecogimportCorticalSurfaces,ECoGSubjectnwbfile=pynwb.NWBFile(...)...cortical_surfaces=CorticalSurfaces()## loop mecortical_surfaces.create_surface(name=name,faces=faces,vertices=veritices)##nwbfile.subject=ECoGSubject(cortical_surfaces=cortical_surfaces)You can optionally attach images of the subject's brain:frompynwb.baseimportImagesfrompynwb.imageimportGrayscaleImagesubject.images=Images(name='subject images',images=[GrayscaleImage('image1',data=image_data)])read:importnwbext_ecogfrompynwbimportNWBHDF5IOio=NWBHDF5IO('path_to_file.nwb','r')nwb=io.read()nwb.subject.cortical_surfacesMATLABinstall:generateExtension('/path/to/ndx-ecog/spec/ndx-ecog.namespace.yaml');write:cortical_surfaces=types.ecog.CorticalSurfaces;%%% loop mesurf=types.ecog.Surface('faces',faces,'vertices',vertices);cortical_surfaces.surface.set(surface_name,surf);%%%file.subject=types.ecog.ECoGSubject(name,cortical_surfaces);
Package: ndx-fllab-novela
ndx-fllab-novela Extension for NWBAboutndx-fllab-novela is a python package containing NWB custom extensions.ExtensionsEdgeAn undirected edge connecting two nodes in a graph.Attributes:namestring: name of this segement nodeedge_nodesarray_data,data: the names of the two nodes in this undirected edge'NodeA generic graph node. Subclass for more specific types of nodes.Attributes:namestring: name of this nodevalueint: value of this node'ApparatusTopological graph representing connected components of a behavioral apparatus.Attributes:namestring: name of apparatusnodeslist: Node objects contained in this apparatusedgeslist: Edge objects contained in this apparatusHeaderDeviceRepresentation of HeaderDevice in NWB.Attributes:headstage_serialstring: headstage_serial from header global configurationheadstage_smart_ref_onstring: headstage_smart_ref_on from header global configurationrealtime_modestring: realtime_mode from header global configurationheadstage_auto_settle_onstring: headstage_auto_settle_on from header global configurationtimestamp_at_creationstring: timestamp_at_creation from header global configurationcontroller_firmware_versionstring: conntroller_firmware_version from header global configurationcontroller_serialstring: conntroller_serial from header global configurationsave_displayed_chan_onlystring: save_displayed_chan_only from header global configurationheadstage_firmware_versionstring: headstage_firmware_version from header global configurationqt_versionstring: qt_version from header global configurationcompile_datestring: compile_date from header global configurationcompile_timestring: compile_time from header global configurationfile_prefixstring: file_prefix from header global configurationheadstage_gyro_sensor_onstring: headstage_gyro_sensor_on from header global configurationheadstage_mag_sensor_onstring: headstage_mag_sensor_on from header global configurationtrodes_versionstring: trodes_version from header global configurationheadstage_accel_sensor_onstring: headstage_accel_sensor_on from header global configurationcommit_headstring: commit_head from header global configurationsystem_time_at_creationstring: system_time_at_creation from header global configurationfile_pathstring: file_path from header global configurationNTrodeRepresentation of NTrode object in NWBAttributes:ntrode_idint: id of electrode groupelectrode_group_idint: id of electrode groupbad_channelsarray_data: ids of bad channelmaparray_data: map of ntrodeProbeRepresentation of Probe object in NWBAttributes:idint: unique id of the probeprobe_typestring: type of probeunitsstring: units in deviceprobe_descriptionstring: probe_description of probenum_shanksint: number of shanks associated with probecontact_side_numberingbool: is contact_side_numbering enabledcontact_sizefloat: value of contact size as floatshanksobject: shanks in the probeThis extension was created usingndx-template.
Package: ndx-fret
ndx-fretNWB extension for storing Fluorescence Resonance Energy Transfer (FRET) experimental data.
A collaboration withJaeger Lab,Emory UniversityandThe Kavli Foundation.Python Installationpipinstallndx-fretPython UsagefrompynwbimportNWBFile,NWBHDF5IOfrompynwb.deviceimportDevicefrompynwb.ophysimportOpticalChannelfromndx_fretimportFRET,FRETSeriesfromdatetimeimportdatetimeimportnumpyasnpnwb=NWBFile('session_description','identifier',datetime.now().astimezone())# Create and add devicedevice=Device(name='Device')nwb.add_device(device)# Create optical channelsopt_ch_d=OpticalChannel(name='optical_channel',description='optical_channel_description',emission_lambda=529.)opt_ch_a=OpticalChannel(name='optical_channel',description='optical_channel_description',emission_lambda=633.)# Create FRETfs_d=FRETSeries(name='donor',fluorophore='mCitrine',optical_channel=opt_ch_d,device=device,description='description of donor series',data=np.random.randn(100,10,10),rate=200.,unit='no unit')fs_a=FRETSeries(name='acceptor',fluorophore='mKate2',optical_channel=opt_ch_a,device=device,description='description of acceptor series',data=np.random.randn(100,10,10),rate=200.,unit='no unit')fret=FRET(name='FRET',excitation_lambda=482.,donor=fs_d,acceptor=fs_a)nwb.add_acquisition(fret)# Write nwb filewithNWBHDF5IO('test_fret.nwb','w')asio:io.write(nwb)print('NWB file written')# Read nwb file and check its contentwithNWBHDF5IO('test_fret.nwb','r',load_namespaces=True)asio:nwb=io.read()print(nwb)
Package: ndx-labmetadata-abf
ndx-labmetadata-abf extension for NWB:NExtension of thelab_meta_datafield.[Python InstallationPython UsagePython Installationpipinstallgit+https://github.com/ben-dichter-consulting/ndx-labmetadata-abf.gitPython UsagefromdatetimeimportdatetimefrompynwbimportNWBFile,NWBHDF5IOfromndx_labmetadata_abfimportLabMetaData_extnwb=NWBFile('session_description','identifier',datetime.now().astimezone())# Creates LabMetaData containerlab_metadata=LabMetaData_ext(name='LabMetaData',cell_id='cell_id',tissue_sample_id='tissue_sample_id',)# Add to filenwb.add_lab_meta_data(lab_metadata)# Write nwb filewithNWBHDF5IO('test_labmetadata.nwb','w')asio:io.write(nwb)# Read nwb file and check its contentwithNWBHDF5IO('test_labmetadata.nwb','r',load_namespaces=True)asio:nwb=io.read()print(nwb.lab_meta_data['LabMetaData'])
Package: ndx-multichannel-volume
ndx-multichannel-volume Extension for NWBThis extension is to add support for volumetric multichannel images. This
extends existing NWB functions for optophysiology imaging to allow for
3 dimensions and a flexible number of channels. There is additional support
for adding metadata that is necessary for imaging in C. Elegans.InstallationTo install this package on Unix/macOS, run in command line
python3 -m pip install --index-urlhttps://pypi.org/simple/--no-deps ndx-multichannel-volumeOn windows, runpy -m pip install --index-urlhttps://pypi.org/simple/--no-deps ndx-multichannel-volumeUsageThis extension is to add support for volumetric multichannel images. This
extends existing NWB functions for optophysiology imaging to allow for
3 dimensions and a flexible number of channels. There is additional support
for adding metadata that is necessary for imaging in C. Elegans.New classes added in this extension are:CElegansSubject - extension of the base subject class with additional attributes
for metadata specific to C. Elegans.MultiChannelVolumeSeries - extension of the base TimeSeries class to support
multiple channels and 3 dimensions.MultiChannelVolume - class for storing mutlichannel volumetric images with
a flexible number of channels.ImagingVolume - alternate version of the native ImagingPlane class for supporting
metadata associated with volumetric multichannel images. Contains a list of optical
channel references as well as an ordered list of how those channels index to the
channels in the image.OpticalChannelPlus - extension of the OpticalChannel class to support additional
information including emission_range, excitation_range, and excitation_lambda.OpticalChannelReferences - contains ordered list of optical channel to represent the
order of the optical channels in the reference volume.VolumeSegmentation - contains segmentation masks for image volumes. There are options
to use either a standard voxel_mask with XYZ information as well as a Cell ID label,
or color_voxel_mask which has RGBW information as well as XYZ.Please seehttps://github.com/focolab/ndx-multichannel-volume/blob/main/src/pynwb/create_NWB.ipynbfor example code on how to use these new data types/classesThis extension was created usingndx-template.
Package: ndx-pinto-metadata
ndx-pinto-metadataThe NWB extension for storing ViRMEN experimental metadata for the Pinto lab.Installationpipinstallndx_pinto_metadataUsagefromuuidimportuuid4fromdatetimeimportdatetimefromdateutil.tzimporttzlocalimportnumpyasnpfrompynwbimportNWBFile,NWBHDF5IOfromhdmf.common.tableimportDynamicTablefromndx_pinto_metadataimportLabMetaDataExtension,MazeExtension# Create NWBFilenwbfile=NWBFile(session_description="session_description",identifier=str(uuid4()),session_start_time=datetime(1970,1,1,tzinfo=tzlocal()),)# Add MazeExtensionmaze_extension=MazeExtension(name="mazes",description="Holds information about the mazes for this task.")# Add row for each mazemaze_extension.add_row(antiFraction=0,cueDensityPerM=3,cueDuration=np.nan,cueProbability=np.inf,cueVisibleAt=10,hideHintUntil=-15,lContext=10,lCue=45,lMemory=10,lStart=5,maxTrialDuration=180,turnHint=1,numTrials=80,numTrialsPerMin=2,criteriaNTrials=100,numSessions=1,performance=np.inf,maxBias=0.2,easyBlock=np.nan,easyBlockNTrials=10,numBlockTrials=40,blockPerform=0.55,geoDistP=np.nan,geoDistPEasy=np.nan,)# Create table for storing stimulus protocol parametersstimulus_protocol=DynamicTable(name="stimulus_protocol",description="Holds information about the stimulus protocol.")protocol_dict=dict(stimulus_code="TowersTaskSwitchStimulusTrain",numMazesInProtocol=11,trialDraw="EradeCapped",stimDraw="LeftOneOnly",cueMinSeparation=12,totalRepeatProbability=0.05,numRepeatTrials=2,visualcolor=np.array([0,0,1]),memorycolor=np.array([0.5,0.5,0.]),princetonImplementation=1,)forprotocol_nameinprotocol_dict:stimulus_protocol.add_column(name=protocol_name,description="stimulus protocol parameter.",)stimulus_protocol.add_row(**protocol_dict)# Create LabMetaDatalab_meta_data=LabMetaDataExtension(name="LabMetaData",experiment_name="TowersTaskSwitchEasy",experiment_code="TowersTaskSwitchEasy",session_index=49,total_reward=0.925,surface_quality=74.22,rig="VR_Widefield",num_trials=242,num_iterations=430233,session_duration=3838.5730088,advance=0,mazes=maze_extension,stimulus_protocol=stimulus_protocol,)# Add to NWBFilenwbfile.add_lab_meta_data(lab_meta_data=lab_meta_data)# Write LabMetaData to NWB filenwbfile_path="virmen_metadata.nwb"withNWBHDF5IO(nwbfile_path,mode="w")asio:io.write(nwbfile)# Check LabMetaData was added to the NWB filewithNWBHDF5IO(nwbfile_path,mode="r",load_namespaces=True)asio:read_nwbfile=io.read()read_nwbfile_lab_metadata=read_nwbfile.lab_meta_data["LabMetaData"]This extension was created usingndx-template.
Package: ndx-pose
ndx-pose Extension for NWBThis is a work in progress and not yet ready for public usage.InstallationTBDUsageimportdatetimeimportnumpyasnpfrompynwbimportNWBFile,NWBHDF5IOfromndx_poseimportPoseEstimationSeries,PoseEstimationnwbfile=NWBFile(session_description='session_description',identifier='identifier',session_start_time=datetime.datetime.now(datetime.timezone.utc))camera1=nwbfile.create_device(name='camera1',description='left camera',manufacturer='my manufacturer')camera2=nwbfile.create_device(name='camera2',description='right camera',manufacturer='my manufacturer')data=np.random.rand(100,3)# num_frames x (x, y, z)timestamps=np.linspace(0,10,num=100)# a timestamp for every frameconfidence=np.random.rand(100)# a confidence value for every framefront_left_paw=PoseEstimationSeries(name='front_left_paw',description='Marker placed around fingers of front left paw.',data=data,unit='pixels',reference_frame='(0,0,0) corresponds to ...',timestamps=timestamps,confidence=confidence,confidence_definition='Softmax output of the deep neural network.',)data=np.random.rand(100,2)# num_frames x (x, y)timestamps=np.linspace(0,10,num=100)# a timestamp for every frameconfidence=np.random.rand(100)# a confidence value for every framefront_right_paw=PoseEstimationSeries(name='front_right_paw',description='Marker placed around fingers of front right paw.',data=data,unit='pixels',reference_frame='(0,0,0) corresponds to ...',timestamps=front_left_paw,# link to timestamps of front_left_pawconfidence=confidence,confidence_definition='Softmax output of the deep neural network.',)pose_estimation_series=[front_left_paw,front_right_paw]pe=PoseEstimation(pose_estimation_series=pose_estimation_series,description='Estimated positions of front paws using DeepLabCut.',original_videos=['camera1.mp4','camera2.mp4'],labeled_videos=['camera1_labeled.mp4','camera2_labeled.mp4'],dimensions=np.array([[640,480],[1024,768]],dtype='uint8'),scorer='DLC_resnet50_openfieldOct30shuffle1_1600',source_software='DeepLabCut',source_software_version='2.2b8',nodes=['front_left_paw','front_right_paw'],edges=np.array([[0,1]],dtype='uint8'),# devices=[camera1, camera2],  # this is not yet supported)behavior_pm=nwbfile.create_processing_module(name='behavior',description='processed behavioral data')behavior_pm.add(pe)path='test_pose.nwb'withNWBHDF5IO(path,mode='w')asio:io.write(nwbfile)withNWBHDF5IO(path,mode='r',load_namespaces=True)asio:read_nwbfile=io.read()read_pe=read_nwbfile.processing['behavior']['PoseEstimation']print(read_pe)Contributors@rly@bendichter@AlexEMGThis extension was created usingndx-template.
Package: ndx-probeinterface
ndx-probeinterface Extension for NWBndx-probeinterfaceis an extension of the NWB format to formally define information about neural probes as data types in NWB files. It comes with helper functions to easily constructndx-probeinterface.Probefromprobeinterface.Probeand vice versa.Installationpipinstallndx_probeinterfaceUsageGoing from aprobeinterface.Probe/``ProbeGroupobject to andx_probeinterface.Probe` objectimportndx_probeinterfacepi_probe=probeinterface.Probe(...)pi_probegroup=probeinterface.ProbeGroup()# from_probeinterface always returns a list of ndx_probeinterface.Probe devicesndx_probes1=ndx_probeinterface.from_probeinterface(pi_probe)ndx_probes2=ndx_probeinterface.from_probeinterface(pi_probegroup)ndx_probes=ndx_probes1.extend(ndx_probes2)nwbfile=pynwb.NWBFile(...)# add Probe as NWB Devicesforndx_probeinndx_probes:nwbfile.add_device(ndx_probe)Going from andx_probeinterface.Probeobject to aprobeinterface.Probeobjectimportndx_probeinterface# load ndx_probeinterface.Probe objects from NWB fileio=pynwb.NWBH5IO(file_path,'r',load_namespaces=True)nwbfile=io.read()ndx_probes=[]fordeviceinnwbfile:ifisinstance(device,ndx_probeinterface.Probe):ndx_probes.append(device)# convert to probeinterface.Probe objectspi_probes=[]forndx_probeinndx_probes:pi_probe=ndx_probeinterface.to_probeinterface(ndx_probe)pi_probes.append(pi_probe)Future plansAdd information about the headstage used for data acquisitionRemove redundant information fromElectrodeTableIncorporate this NDX into the core NWB schemaThis extension was created usingndx-template.