Skip to content

Can't read from one file then save to another file #668

@VBaratham

Description

@VBaratham

1) Bug

Loading an NWBFile from one file, then saving it to another causes ValueError: Can't change container_source once set to be thrown

Steps to Reproduce

from datetime import datetime                                                                                         
from pynwb import NWBFile, NWBHDF5IO, TimeSeries                                                                   
                                                                                                                      
if __name__ == '__main__':                                                                                            
    nwb = NWBFile(source='', session_description='', identifier='', session_start_time=datetime.now())                                                                                    
    ts1 = TimeSeries(name='timeseries1', source='source1', data=[4,5,6],                                              
                     unit='na1', rate=1.0, starting_time=0.0)                                                         
    nwb.add_acquisition(ts1)                                                                                          
    with NWBHDF5IO('test_append.nwb', mode='w') as io:                                                                
        io.write(nwb)                                                                                                 
                                                                                                                      
    f = NWBHDF5IO('test_append.nwb')                                                                                  
    nwb = f.read()                                                                                                    
    ts2 = TimeSeries(name='timeseries2', source='source2', data=[4,5,6],                                              
                     unit='na1', rate=1.0, starting_time=0.0)                                                         
    nwb.add_acquisition(ts2)                                                                                          
    with NWBHDF5IO('test_append2.nwb', mode='a') as io:                                                               
        io.write(nwb)  

Environment

Please describe your environment according to the following bullet points.

  • Python Executable: Conda
  • Python Version: Python 2.7.15 and 3.5.1
  • Operating System: Linux
  • Pynwb Version: 0.5.1.post0.dev112

Checklist

  • Have you ensured the feature or change was not already reported ?
  • Have you included a brief and descriptive title?
  • Have you included a clear description of the problem you are trying to solve?
  • Have you included a minimal code snippet that reproduces the issue you are encountering?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted: deep diverequest for community contributions that will involve many parts of the code base

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions