Skip to content

Instantly share code, notes, and snippets.

View djvine's full-sized avatar

David Vine djvine

View GitHub Profile
@djvine
djvine / dataexchange dataset overwrite
Created September 17, 2014 21:16
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',
@djvine
djvine / Using pip freeze & install
Last active August 29, 2015 14:06
Demonstrate how to use pip to automate package installing
#I find the best way to use this is to create a fresh virtual environment and go from there.
# Record all the packages in the current environment to a txt file
pip freeze > requirements.txt
# Install all packages in txt file to current environment
pip install -r requirements.txt
@djvine
djvine / Change data-exchange root
Created September 15, 2014 18:46
Demonstrating how to change the exchange group using the 'root' parameter
f.add_entry(
DataExchangeEntry.data(
root='/exchange_1',
data={'value': data, 'units':'counts', 'description': 'transmission', 'axes':'theta:y:x' }
)
)