Skip to content

Instantly share code, notes, and snippets.

@djvine
Created September 17, 2014 21:16
Show Gist options
  • Save djvine/1dbf2f26b2327d17c57d to your computer and use it in GitHub Desktop.
Save djvine/1dbf2f26b2327d17c57d to your computer and use it in GitHub Desktop.
Demonstrate the overwrite option to data exchange
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