This issue is from a Codex global scan of the repository.
create_random_disturb.py accepts -dstyle normal, but that path raises a NumPy argument error.
Evidence:
|
def gen_random_disturb(dmax, a, b, dstyle="uniform"): |
|
d0 = np.random.rand(3) * (b - a) + a |
|
dnorm = np.linalg.norm(d0) |
|
if dstyle == "normal": |
|
dmax = np.random.standard_normal(0, 0.5) * dmax |
|
elif dstyle == "constant": |
|
pass |
|
else: |
|
# use if we just wanna a disturb in a range of [0, dmax), |
|
dmax = np.random.random() * dmax |
|
parser = argparse.ArgumentParser( |
|
description="Script to generate random disturb configurations" |
|
) |
|
parser.add_argument("fin", type=str, help="input file name") |
|
parser.add_argument("nfile", type=int, help="number of files to be created") |
|
parser.add_argument("dmax", type=float, help="dmax") |
|
parser.add_argument( |
|
"-etmax", |
|
type=float, |
|
default=0, |
|
help="etmax for random strain tensor generations", |
|
) |
|
parser.add_argument( |
|
"-diag", |
|
type=int, |
|
default=0, |
|
help="only diagonal elements of strain tensors are randomized?", |
|
) |
|
parser.add_argument("-ofmt", type=str, default="lmp", help="output fileformat") |
|
parser.add_argument( |
|
"-dstyle", |
|
type=str, |
|
default="uniform", |
|
help="random distribution style [uniform?]", |
|
) |
|
parser.add_argument( |
|
"-wd", |
The parser exposes -dstyle and gen_random_disturb() checks for dstyle == "normal", but calls np.random.standard_normal(0, 0.5). NumPy's standard_normal accepts only the optional size positional argument, so this raises TypeError instead of generating a normally distributed disturbance.
Expected behavior: use an API such as np.random.normal(loc=0, scale=0.5) or otherwise implement the intended normal-distribution scaling.
This issue is from a Codex global scan of the repository.
create_random_disturb.pyaccepts-dstyle normal, but that path raises a NumPy argument error.Evidence:
dpgen/dpgen/data/tools/create_random_disturb.py
Lines 33 to 42 in 7af5246
dpgen/dpgen/data/tools/create_random_disturb.py
Lines 291 to 317 in 7af5246
The parser exposes
-dstyleandgen_random_disturb()checks fordstyle == "normal", but callsnp.random.standard_normal(0, 0.5). NumPy'sstandard_normalaccepts only the optionalsizepositional argument, so this raisesTypeErrorinstead of generating a normally distributed disturbance.Expected behavior: use an API such as
np.random.normal(loc=0, scale=0.5)or otherwise implement the intended normal-distribution scaling.