nucleon_elastic_ff.data.scripts.fft

Script for time fourier transforming correlator data

nucleon_elastic_ff.data.scripts.fft.fft(root: str, name_input: str, name_output: str, max_momentum: Optional[int] = None, chunk_size: Optional[int] = None, overwrite: bool = False, cuda: bool = True)[source]

Recursively scans dir for files, ffts and shifts and chops user specified momenta.

Routine FFTs 4D correlation functions. If max_momentum is given this routine cuts the output array in a all momentum directions.

Note

The user specifies max_momentum = 5, which means, in each direction, x, y, z, the momentum should is of from [0,1,2,3,4,5,-5,-4,-3,-2,-1], just like a regular FFT space, except the higher valued modes are chopped out.

The input files must be h5 files (ending with “.h5”) and must have name_input in their file name. Files which have name_output as name are excluded. Also, this routine ignores exporting to files which already exist. Once all files are fixed, this routine calls slice_file on each file. This routines transforms local_current dsets to momentum_current dsets.

Note

This routine explicitly assumes that the datasets to transform are of shape shape1 + [Nz, Ny, Nx] + [2] where shape1 can be anything the second shape is the to transformed shape and the last shape corresponds to real / complex.

Arguments
root: str
The directory to look for files.
name_input: str
Files must match this pattern to be submitted for slicing.
name_output: str
Files must not match this pattern to be submitted for slicing. Also the sliced output files will have the input name replaced by the output name. This also includes directory names.
max_momentum: int
The momentum at which the FT is cutoff in each spatial dimension.
chunk_size: Optional[int] = None
Reads in arrays in chunks and applys fft chunkwise. This reduce the memory load. For now, only slices the zeroth-dimension.
overwrite: bool = False
Overwrite existing sliced files.
cuda: bool = True
Use cupy to run fft if possible.
nucleon_elastic_ff.data.scripts.fft.fft_file(file_address_in: str, file_address_out: str, max_momentum: Optional[int] = None, dset_patterns: List[str] = ('local_current', 'x[0-9]+_y[0-9]+_z[0-9]+_t[0-9]+', '4D_correlator'), chunk_size: Optional[int] = None, overwrite: bool = False, cuda: bool = True)[source]

Reads input file and writes ffts and cuts data to output file.

This methods scans all datasets within the file. If a data set has “local_current” in its name it is ffted in its spatial components. The slicing info is inferred by the argument max_momentum. This routines transforms local_current dsets to momentum_current dsets. Also the slicing meta info is stored in the resulting output file in the meta attribute of momentum_current.

Note

The user specifies max_momentum = 5, which means, in each direction, x, y, z, the momentum should is of from [0,1,2,3,4,5,-5,-4,-3,-2,-1], just like a regular FFT space, except the higher valued modes are chopped out.

Note

This routine explicitly assumes that the datasets to transform are of shape shape1 + [Nz, Ny, Nx] + [2] where shape1 can be anything the second shape is the to transformed shape and the last shape corresponds to real / complex.

Arguments
file_address_in: str
Address of the to be scanned and sliced HDF5 file.
file_address_out: str
Address of the output HDF5 file.
max_momentum: Optional[int] = None
The momentum at which the FT is cutoff in each spatial dimension.
dset_patterns: List[str] = (
“local_current”, “x[0-9]+_y[0-9]+_z[0-9]+_t[0-9]+”, “4D_correlator”,
),
List of regex patterns data sets must match to be ffted (needs to match one).
chunk_size: Optional[int] = None
Reads in arrays in chunks and applys fft chunkwise. This reduce the memory load. For now, only slices the zeroth-dimension.
overwrite: bool = False
Overwrite existing sliced file.
cuda: bool = True
Use cupy to run fft if possible.
Raises
KeyError:
If no dset was transformed.
nucleon_elastic_ff.data.scripts.fft.main()[source]

Runs argparse for fft_file.