Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check keywords existing in models.py before checking psr.flags #212

Open
mtlam opened this issue Jul 12, 2023 · 0 comments
Open

Check keywords existing in models.py before checking psr.flags #212

mtlam opened this issue Jul 12, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@mtlam
Copy link
Member

mtlam commented Jul 12, 2023

I met with a few folks in Europe to try to get our timing (pint_pal) and noise modeling working with simulated libstempo data. However, the simulated tim files lacked the pta and f flags needed in models.py and caused a crash:

if ('NANOGrav' in psr.flags['pta'] or 'CHIME' in psr.flags['f']) and not is_wideband:

They were able to fake it out by giving a fake pta flag but also needing a fake f flag. I was going to go in to change these to check for the existence of these flags first in the if statement but checks for 'NANOGrav' in psr.flags['pta'] are throughout the code.

While perhaps less safe, I would recommend writing a helper function somewhere along the lines of

def check_flag(psr, key, value):
    return (key in psr.flags and value in psr.flags[key])

and then replacing the if statements appropriately throughout.

@mtlam mtlam added the enhancement New feature or request label Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant