read_metadata.py 424 B

123456789101112131415
  1. from pynwb import NWBHDF5IO
  2. # Replace 'your_file.nwb' with the actual path to your NWB file
  3. nwb_file_path = '../sub-M388/sub-M388_obj-1tv1gbj_ecephys.nwb'
  4. # Read the NWB file
  5. with NWBHDF5IO(nwb_file_path, 'r') as io:
  6. nwbfile = io.read()
  7. # Get all metadata fields as a dictionary
  8. metadata_dict = nwbfile.fields
  9. # Print or use the metadata dictionary as needed
  10. print(metadata_dict)
  11. print(metadata_dict["acquisition"])