Skip to content

Commit

Permalink
Make parameters more optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoughlin committed Jun 30, 2022
1 parent 1c1cc15 commit 5148e0b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions nmma/eos/create_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ def main():
parser.add_argument(
"--eos-file",
type=str,
required=True,
required=False,
help="EOS file in (radius [km], mass [solar mass], lambda)",
)
parser.add_argument(
"--binary-type", type=str, required=True, help="Either BNS or NSBH"
"--binary-type", type=str, required=False, help="Either BNS or NSBH"
)
parser.add_argument(
"--eject",
Expand All @@ -268,8 +268,9 @@ def main():
)
args = parser.parse_args()

# check the binary type
assert args.binary_type in ["BNS", "NSBH"], "Unknown binary type"
if not args.original_parameters:
# check the binary type
assert args.binary_type in ["BNS", "NSBH"], "Unknown binary type"

# check injection file format
if args.injection_file:
Expand All @@ -280,10 +281,13 @@ def main():
or args.injection_file.endswith(".dat")
), "Unknown injection file format"

# load the EOS
radii, masses, lambdas = np.loadtxt(args.eos_file, usecols=[0, 1, 2], unpack=True)
interp_mass_radius = scipy.interpolate.interp1d(masses, radii)
interp_mass_lambda = scipy.interpolate.interp1d(masses, lambdas)
if not args.original_parameters:
# load the EOS
radii, masses, lambdas = np.loadtxt(
args.eos_file, usecols=[0, 1, 2], unpack=True
)
interp_mass_radius = scipy.interpolate.interp1d(masses, radii)
interp_mass_lambda = scipy.interpolate.interp1d(masses, lambdas)

# load the injection json file
if args.injection_file:
Expand Down

0 comments on commit 5148e0b

Please sign in to comment.