callat-qcd / nucleon_elastic_FF

Scripts for generating xml input tasks and collecting data for our nucleon elastic formfactor project
https://callat-qcd.github.io/nucleon_elastic_ff_doc/
1 stars 1 forks source link

h5avg and h5concat feature request for cfgs_srcs #24

Open walkloud opened 5 years ago

walkloud commented 5 years ago

There is one dset in both h5avg and h5concat that needs special treatment. The cfgs_srcs array is a 2-dimensional array storing the information

[[ cfg_0, Nsrc_0],
   cfg_1, Nsrc_1],
...
]

h5avg: instead of averaging this dset, what we need to do is preserve the 0th column and add the second column. We don't need to match the 0th column to make sure it is the same, as this is almost guaranteed if the shape of the data matches. So - What we need is

cfgs_srcs_tmp = cfgs_srcs_0
cfgs_srcs_tmp[:,1] += cfgs_srcs_1[:,1]
... for all sets being averaged

h5concat: instead of simply concatenating, we need to add an offset to all dsets after the first so that they have a unique cfg identifying number. This is a two step procedure.

  1. Identify the maximum cfg number in each cfgs_srcs dset being matched. Then round up to the next largest integer of the most significant digit. For example, the a15m135XL streams run from 500 - 1745. So this offset base would be cfg_offset=2000.

  2. When performing the concatenation, we should add n*cfg_offset to the 0th column. For example:

cfgs_srcs_new = 
for n,cs in enumerate(cfgs_srcs_sets):
    if n == 0:
        cfgs_srcs_new = cs
    else:
        tmp = cs
        tmp[:,0] += n * cfg_offset
        cfgs_srcs_new = np.concatenate((cfgs_srcs_new,tmp),axis=0)
walkloud commented 4 years ago

instead of the code deciding the offset - the user should have to supply it