Hi there,
I’m new to OpenMC and have been struggling with tallying currents.
The filter i build seems to be working fine, but trying to read the results from the tally seems to be impossible with pandas.
This is even true for the example notebook on https://docs.openmc.org/en/stable/examples/mdgxs-part-ii.html
When trying it, the line “current_tally.get_pandas_dataframe()” will throw an error:
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-19-81578235da85> in <module> ----> 1 current_tally.get_pandas_dataframe() ~/anaconda3/envs/openmc/lib/python3.7/site-packages/openmc/tallies.py in get_pandas_dataframe(self, filters, nuclides, scores, derivative, paths, float_format) 1530 for f, stride in zip(self.filters, self.filter_strides): 1531 filter_df = f.get_pandas_dataframe( -> 1532 data_size, stride, paths=paths) 1533 df = pd.concat([df, filter_df], axis=1) 1534 ~/anaconda3/envs/openmc/lib/python3.7/site-packages/openmc/filter.py in get_pandas_dataframe(self, data_size, stride, **kwargs) 841 842 # Initialize a Pandas DataFrame from the mesh dictionary --> 843 df = pd.concat([df, pd.DataFrame(filter_dict)]) 844 845 return df ~/anaconda3/envs/openmc/lib/python3.7/site-packages/pandas/core/frame.py in __init__(self, data, index, columns, dtype, copy) 390 dtype=dtype, copy=copy) 391 elif isinstance(data, dict): --> 392 mgr = init_dict(data, index, columns, dtype=dtype) 393 elif isinstance(data, ma.MaskedArray): 394 import numpy.ma.mrecords as mrecords ~/anaconda3/envs/openmc/lib/python3.7/site-packages/pandas/core/internals/construction.py in init_dict(data, index, columns, dtype) 210 arrays = [data[k] for k in keys] 211 --> 212 return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype) 213 214 ~/anaconda3/envs/openmc/lib/python3.7/site-packages/pandas/core/internals/construction.py in arrays_to_mgr(arrays, arr_names, index, columns, dtype) 49 # figure out the index, if necessary 50 if index is None: ---> 51 index = extract_index(arrays) 52 else: 53 index = ensure_index(index) ~/anaconda3/envs/openmc/lib/python3.7/site-packages/pandas/core/internals/construction.py in extract_index(data) 315 lengths = list(set(raw_lengths)) 316 if len(lengths) > 1: --> 317 raise ValueError('arrays must all be same length') 318 319 if have_dicts: ValueError: arrays must all be same length
So far, I have not figured out another way to get the data I need from the tally.
Thanks for any help!