hemantaph / ler

Gravitational waves lensing rate calculator
MIT License
2 stars 2 forks source link

`a_max` parameter hardcoded #8

Open angelgarron opened 2 weeks ago

angelgarron commented 2 weeks ago

Hi @hemantaph,

We noticed that in https://github.com/hemantaph/ler/blob/main/ler/gw_source_population/cbc_source_parameter_distribution.py#L1198, the a_max parameter is hardcoded and would like to request that this parameter could be specified by the user.

CC @dbkeitel, @NehaSinghGW

hemantaph commented 1 week ago

I don't think it's hard-coded. It's for simplifying things when the user wants to use event_type=BBh or BNS or NSBH (with default param priors). Here is an example of changing the prior range of spin. So in ler, every prior function/function-params are replaceable.

from ler.rates import LeR
import matplotlib.pyplot as plt

ler = LeR(
    npool=4, 
    verbose=False, 
    snr_type='inner_product', 
    waveform_approximant='IMRPhenomXPHM', 
    spin_zero=False, 
    spin_precession=True,
    source_priors_params=dict(a_1=dict(min_=0.0, max_=0.5), a_2=dict(min_=0.0, max_=0.5)),
    )

unlensed_param = ler.unlensed_cbc_statistics(size=10000, resume=False, save_batch=False)

a_1 = unlensed_param['a_1']
plt.hist(a_1, bins=50, histtype='step', label='a_1')
plt.xlabel('a_1')
plt.ylabel('Counts')
plt.legend()
plt.show()
hemantaph commented 1 week ago

Thanks for pointing it out. I will include it in the documentation with more explanation.

angelgarron commented 1 week ago

Great, thanks!