From 231a6cefe5262d0e5c934a2e48578e1755ca6d6c Mon Sep 17 00:00:00 2001 From: "Peter T. H. Pang" Date: Tue, 5 Dec 2023 11:46:46 +0100 Subject: [PATCH] Minor fix on Powerlaw prior class --- src/jimgw/prior.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jimgw/prior.py b/src/jimgw/prior.py index aa1366af..0ce77d09 100644 --- a/src/jimgw/prior.py +++ b/src/jimgw/prior.py @@ -2,7 +2,7 @@ import jax.numpy as jnp from flowMC.nfmodel.base import Distribution from jaxtyping import Array, Float -from typing import Callable +from typing import Callable, Union from dataclasses import field @@ -352,16 +352,16 @@ def __init__( self, xmin: float, xmax: float, - alpha: float, + alpha: Union[int, float], naming: list[str], transforms: dict[tuple[str, Callable]] = {}, ): super().__init__(naming, transforms) assert isinstance(xmin, float), "xmin must be a float" assert isinstance(xmax, float), "xmax must be a float" - assert isinstance(alpha, (float)), "alpha must be a float" + assert isinstance(alpha, (int, float)), "alpha must be a int or a float" if alpha < 0.0: - assert alpha < 0.0 or xmin > 0.0, "With negative alpha, xmin must > 0" + assert xmin > 0.0, "With negative alpha, xmin must > 0" assert self.n_dim == 1, "Powerlaw needs to be 1D distributions" self.xmax = xmax self.xmin = xmin