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

Issue when TS_vaue and Variability_Index being empty strings #69

Closed
sfegan opened this issue Oct 25, 2024 · 3 comments
Closed

Issue when TS_vaue and Variability_Index being empty strings #69

sfegan opened this issue Oct 25, 2024 · 3 comments

Comments

@sfegan
Copy link

sfegan commented Oct 25, 2024

          We have had the same problem a few times at LLR when analyzing ROIs that contain the Crab Nebula. I understood it to be due to the fact that the Crab is modelled by multiple components, one of which is fixed in the catalog, so there is no TS_value given for it and the code dies. The same problem could also occur for sources that don't have "Variability_Index".

We ended up fixing it by changing the code to test explicitly that these two attributes aren't a null string before trying to make them into float :

        #evaluate variability and significance threshold info
        self.sources[name].update([('variable',source.getAttribute('Variability_Index')=="" or float(source.getAttribute('Variability_Index'))>=self.variability_threshold),
            ('significant',source.getAttribute('TS_value')=="" or float(source.getAttribute('TS_value'))>=self.sigma_to_free)])

We default to keeping them in the model if the attribute isn't present.

Originally posted by @sfegan in #68 (comment)

@sfegan
Copy link
Author

sfegan commented Oct 25, 2024

Sorry to open another issue here.. github won't let me reopen the other issue as I wasn't the original author

@physicsranger
Copy link
Owner

Thanks for opening this. I should be able to make an update this weekend unless you want to try and do a PR.

@physicsranger
Copy link
Owner

Okay, it took me a little bit longer to find time to address this issue, but that is now done with release v1.10.11 (on PyPI and created as a tagged release on GitHub). I did this creating a function LATSourceModel.utilities.float_conversion to make things a bit more compact. I tested building a region centered near the Crab, using the XML catalog, and was able to make the model successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants