Given a python list containing str members, each with a different length, punx tree only renders the first component as mask_names:NX_CHAR[9] = Q=0.002, not all 27 members (or some subset).
def q_based_mask_names(q_array):
"""
Create a text name of each mask from its Q value
Write each Q value to 2 significant figures,
using fixed-point notation, no trailing zeros
Result should be a string that h5py can write
in a string array as a dataset, thus it must
be byte-encoded.
"""
def formatter(value):
s_value = f"{value:.2e}" # 2 sig figs
s_value = f"Q={float(s_value)}" # fixed-point
return s_value.encode() # byte-encode
return list(map(formatter, q_array))
Given a python list containing str members, each with a different length,
punx tree
only renders the first component asmask_names:NX_CHAR[9] = Q=0.002
, not all 27 members (or some subset).This code writes the HDF:
This code creates the list:
where
xpcs["ql_dyn"]
is a list offloat
andSee this HDFview of the data file: