Skip to content

Commit 8aedd70

Browse files
committed
Comit 0.6 to github and bump version number
Fixed problem with loading and saving with a subpath
1 parent 1b18793 commit 8aedd70

File tree

8 files changed

+39
-78
lines changed

8 files changed

+39
-78
lines changed

CADETPython.egg-info/PKG-INFO

Lines changed: 0 additions & 55 deletions
This file was deleted.

CADETPython.egg-info/SOURCES.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

CADETPython.egg-info/dependency_links.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

CADETPython.egg-info/requires.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

CADETPython.egg-info/top_level.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

cadet/cadet.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,27 @@ def recursively_load_dict( data, func):
141141
ans[key] = item
142142
return ans
143143

144+
def set_path(obj, path, value):
145+
"paths need to be broken up so that subobjects are correctly made"
146+
path = path.split('/')
147+
path = [i for i in path if i]
148+
149+
temp = obj
150+
for part in path[:-1]:
151+
temp = temp[part]
152+
153+
temp[path[-1]] = value
154+
144155
def recursively_load( h5file, path, func, paths):
145156
ans = Dict()
146157
if paths is not None:
147158
for path in paths:
148159
item = h5file.get(path, None)
149160
if item is not None:
150161
if isinstance(item, h5py._hl.dataset.Dataset):
151-
ans[path[1:]] = item[()]
162+
set_path(ans, path, item[()])
152163
elif isinstance(item, h5py._hl.group.Group):
153-
ans[path[1:]] = recursively_load(h5file, path + '/', func, None)
164+
set_path(ans, path, recursively_load(h5file, path + '/', func, None))
154165
else:
155166
for key_original in h5file[path].keys():
156167
key = func(key_original)

examples/cadet_json.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
import cadet
22

3-
sim = cadet.Cadet()
4-
sim.filename = r"C:\Users\kosh_000\Documents\Visual Studio 2017\Projects\CADETMatch\Examples\Example1\Dextran\dextran_pulse.h5"
5-
sim.load()
3+
data = cadet.H5()
4+
data.filename = r"F:\MCMC\Synthetic\Bypass\Bypass_MCMC_pump_delay\mcmc_refine\mcmc\mcmc.h5"
5+
data.load(paths=["/bounds_change/json",])
66

7-
sim.save_json(r"C:\Users\kosh_000\Documents\Visual Studio 2017\Projects\CADETMatch\Examples\Example1\Dextran\dextran_pulse.json")
87

9-
sim.load_json(r"C:\Users\kosh_000\Documents\Visual Studio 2017\Projects\CADETMatch\Examples\Example1\Dextran\dextran_pulse.json")
8+
print(data)
9+
10+
print("bounds json", data.root.bounds_change)
11+
12+
13+
print("json", data.root.bounds_change.json)
14+
15+
16+
17+
data.load(paths=["/bounds_change",])
18+
19+
20+
21+
print("bounds_change", data)
22+
23+
24+
25+
data.load()
26+
27+
28+
29+
print("all", data)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="CADET",
8-
version="0.5",
8+
version="0.6",
99
author="William Heymann",
1010
author_email="[email protected]",
1111
description="CADET is a python interface to the CADET chromatography simulator",

0 commit comments

Comments
 (0)