Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from hax.treemakers.peak_treemakers import PeakExtractor
class CoinPeaksInTPC(PeakExtractor):
__version__ = '0.0.3'
stop_after = 10
peak_fields = ['area', 'type', 'x', 'y', 'n_hits', 'area_per_channel']
event_cut_list = ['event_number %2 == 0' ]
peak_cut_list = ['detector == "tpc"', 'type !="lone_hit"']
extra_branches = ['peaks.area', 'peaks.type', 'peaks.reconstructed_positions*', 'peaks.n_hits', 'peaks.detector']
d_tpit = hax.minitrees.load(dataset, [CoinPeaksInTPC, 'Fundamentals'])
TypeError Traceback (most recent call last)
<ipython-input-76-ac59eb1963d2> in <module>()
----> 1 d_tpit = hax.minitrees.load(dataset, [CoinPeaksInTPC, 'Fundamentals'])
2 d_tpit.head()
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/hax-2.4.0-py3.4.egg/hax/minitrees.py in load(datasets, treemakers, preselection, force_reload, delayed, num_workers, compute_options, cache_file, remake_cache, event_list)
506
507 result = dask.dataframe.from_delayed(
--> 508 partial_results, meta=partial_results[0].compute())
509
510 if not delayed:
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/dask/base.py in compute(self, **kwargs)
77 Extra keywords to forward to the scheduler ``get`` function.
78 """
---> 79 return compute(self, **kwargs)[0]
80
81 @classmethod
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/dask/base.py in compute(*args, **kwargs)
177 dsk = merge(var.dask for var in variables)
178 keys = [var._keys() for var in variables]
--> 179 results = get(dsk, keys, **kwargs)
180
181 results_iter = iter(results)
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/dask/threaded.py in get(dsk, result, cache, num_workers, **kwargs)
74 results = get_async(pool.apply_async, len(pool._pool), dsk, result,
75 cache=cache, get_id=_thread_get_id,
---> 76 **kwargs)
77
78 # Cleanup pools associated to dead threads
/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/dask/async.py in get_async(apply_async, num_workers, dsk, result, cache, get_id, raise_on_exception, rerun_exceptions_locally, callbacks, dumps, loads, **kwargs)
491 _execute_task(task, data) # Re-execute locally
492 else:
--> 493 raise(remote_exception(res, tb))
494 state['cache'][key] = res
495 finish_task(dsk, key, state, results, keyorder.get)
TypeError: Column area_per_channel is an array field, and you want to save to root. Either (1) use MultipleRowExtractor-based minitrees; or (2) add a uses_arrays=True attribute to the type class; or (3) use pickle as your minitree format.
Traceback
---------
File "/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/dask/async.py", line 268, in execute_task
result = _execute_task(task, data)
File "/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/dask/async.py", line 249, in _execute_task
return func(*args2)
File "/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/dask/compatibility.py", line 47, in apply
return func(*args, **kwargs)
File "/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/hax-2.4.0-py3.4.egg/hax/minitrees.py", line 385, in load_single_dataset
run_id, treemaker, force_reload=force_reload, event_list=event_list)
File "/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/hax-2.4.0-py3.4.egg/hax/minitrees.py", line 349, in load_single_minitree
get_format(minitree_path, treemaker).save_data(metadata_dict, skimmed_data)
File "/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/hax-2.4.0-py3.4.egg/hax/minitree_formats.py", line 69, in save_data
self.treemaker.__class__.__name__))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.