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

TargetList filtering change #405

Merged
merged 11 commits into from
Feb 7, 2025
Merged

TargetList filtering change #405

merged 11 commits into from
Feb 7, 2025

Conversation

CoreySpohn
Copy link
Collaborator

@CoreySpohn CoreySpohn commented Dec 12, 2024

Describe your changes

Added a new system to handle optional target list filters that maintains backwards compatibility.

TargetList optional filter system

There's a new "optional_filters" keyword that can be provided that dictates which filters to apply. It is intended to be used with these filter methods:

  • binary_filter
  • outside_IWA_filter
  • life_expectancy_filter
  • main_sequence_filter
  • fgk_filter
  • vis_mag_filter (takes Vmagcrit as input)
  • max_dmag_filter
  • completeness_filter (gets run after the completeness values are calculated)
  • vmag_filter (takes vmag_range as input)
  • ang_diam_filter
    where the filters can be provided in the input JSON with the format
"optional_filters": {
    "binary_filter": {"enabled": true},
    "outside_IWA_filter": {"enabled": false},
    "ang_diam_filter": {"enabled": true},
    "vmag_filter": { "enabled": true, "params": {"vmag_range": [4,12]} }
  }

where the "params" key holds any arguments that are passed to the filter function (there are no defaults currently set for those parameters but could be done with keyword arguments). Everything except completeness_filter is run prior to calculating intCutoff_and_saturation_dMag values which can reduce the computation time there.

Backwards compatibility

The logic around existing filters that run in the TL init like nan_filter, zero_lum_filter, cherry_pick_stars, etc. are all unchanged. The keyword filterBinaries still works, but raises a warning (not error) and gets overridden in the case that the user provides a conflicting value in the optional_filters dictionary.

Defaults

The filters that are on by default are the same as before the pull: binary_filter, outside_IWA_filter, and completeness_filter. If we want to enable any others by default it's an easy change.

New filters

  • vmag_filter: Filters out any stars that have Vmag values outside the provided range
  • ang_diam_filter: Filters out any stars that have angular radius larger than minimum IWA.

SIMBADCatalog bugfix

I am getting an error in SIMBAD catalog where all empty values from scipy's loadmat function are empty arrays and therefore can't be compared with bc[i]=='cut' since array comparisons have ambiguous truthiness. The change itself is just making the comparison type(bc[i])==str and bc[i]=='cut' which shouldn't affect any functionality. It's not clear to me why this behavior is different now, but I tested python 3.10, 3.11, and 3.12 with various scipy versions and all had the same error (which makes me think I have been using the same SIMBAD300.pkl file for a long time and clearing my .EXOSIMS cache revealed a functionality change from a while ago).

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix

Reference any relevant issues (don't forget the #)

#404

Checklist before requesting a review

  • I have verified that all unit tests pass in a clean virtual environment and added new unit tests, as needed
  • I have run e2eTests and added new test scripts, as needed
  • I have verified that all docstrings are properly formatted and added new documentation, as needed

@dsavransky dsavransky merged commit 22d9ccf into master Feb 7, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants