Created
September 17, 2014 21:16
-
-
Save djvine/1dbf2f26b2327d17c57d to your computer and use it in GitHub Desktop.
Demonstrate the overwrite option to data exchange
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dataexchange.xtomo.data_xchange as dex | |
import numpy as np | |
data = np.zeros((10,10)) | |
f = dex.DataExchangeFile('text.h5', 'w') | |
# Create initial entry | |
f.add_entry( | |
DataExchangeEntry.data( | |
root='/exchange_1', | |
data={'value': data, 'units':'counts', 'description': 'transmission', 'axes':'theta:y:x' } | |
) | |
) | |
# Overwrite initial entry | |
f.add_entry( | |
DataExchangeEntry.data( | |
root='/exchange_1', | |
data={'value': data, 'units':'counts', 'description': 'transmission', 'axes':'theta:y:x' } | |
), overwrite=True | |
) | |
# This will not overwrite | |
f.add_entry( | |
DataExchangeEntry.data( | |
root='/exchange_1', | |
data={'value': data, 'units':'counts', 'description': 'transmission', 'axes':'theta:y:x' } | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment