nanograv / pint_pal

A long-lived repository for NANOGrav Pulsar Timing workflows and analysis.
MIT License
6 stars 16 forks source link

add_noise_to_model includes Ecorr even if -pta flag is different from NANOGrav in timfile #44

Closed FrancescoIraci closed 1 month ago

FrancescoIraci commented 11 months ago

In the notebook [https://github.com/nanograv/pint_pal/blob/main/nb_templates/process_v1.2.ipynb] I'm facing an issue with the function nu.add_noise_to_model: I'm running the noise analysis using the timfile attached, with flags -pta EPTA and -f ciao (dummy variable). Since -pta flag is different from NANOGrav, the ecorr parameter is not included in the noise modelling (only efac and equad). However, while calling nu.add_noise_to_model, it seems that an ecorr parameter must be added when performing non wide-band timing as in my case (I'm attaching the error). The error should come from lines 414-418 of https://github.com/nanograv/pint_pal/blob/main/src/pint_pal/noise_utils.py#L251 in which:

if not using_wideband:
            ec_comp.add_param(param = ecorr_params[ii], setup = True)
        else:
            dm_comp.add_param(param = dmefac_params[ii])
            dm_comp.add_param(param = dmequad_params[ii], setup = True)

It could solved by adding the case of non-wide-band toas without writing ecorr parameter in the parfile.

toa.tim.txt

ecorr_issue

Parfile is: parfile.txt

rossjjennings commented 11 months ago

This probably results from the fact that PINT Pal was originally developed with a narrow focus on the NANOGrav 15-year data set, where we always used ECORR. Some of us have been using it with IPTA data for Early DR3, but in the IPTA work we've been using a very different noise modeling setup that doesn't use nu.add_noise_to_model(), so we haven't needed to adapt that part of the code to non-NANOGrav data before now. I'll see if I can figure out what needs to be changed to fix this.

rossjjennings commented 11 months ago

@FrancescoIraci Have you had a chance to test this since the fix was merged? It's not in the PyPI version yet, and won't be until we release the new version, but you can get the latest changes either by cloning this repository and using pip install . from the top-level pint-pal directory, or by running

pip install git+https://github.com/nanograv/pint_pal.git@main
FrancescoIraci commented 10 months ago

Hi @rossjjennings, I will probably be able to check that next week. Sorry for the delay

rossjjennings commented 1 month ago

Closing since this should be fixed by #45.