beast icon indicating copy to clipboard operation
beast copied to clipboard

Ast generation speedup

Open benjamin-gibson opened this issue 1 month ago • 2 comments

There was a specific for loop in pick_models_toothpick_style() that took forever looping through each SED to choose which ones to keep as artificial stars. The new code instead loops through filters and un-full bins and vectorizes over the SEDs. This is significantly faster -- new artificial stars can be generated in seconds.

I also implemented the use of the mag_limits() function for pick_models_toothpick_style(), so now users can set the keywords ast_fluxbin_maglimits and ast_filters_inside_maglimits in their beast_settings.txt file (example below). This allows users to only get back model SEDs that have fluxes within some magnitude range (ast_fluxbin_maglimits) for a critical number of filters (ast_filters_inside_maglimits).

Example:
# ast_fluxbin_maglimits : dictionary (optional)
#   If supplied, these magnitude limits will be applied to the SED model grids
#   when selecting additional ASTs. This is a dictionary that includes
#   information for the magnitude cuts as a function of the filters included.
# ast_fluxbin_maglimits = None
ast_fluxbin_maglimits = {"HST_ACS_WFC_F555W": [16,30], "HST_ACS_WFC_F814W": [16,30], "HST_WFC3_F275W": [16,30], "HST_WFC3_F336W": [16,30], "HST_WFC3_F438W": [16,30], "HST_WFC3_F555W": [16,30], "HST_WFC3_F814W": [16,30], "JWST_NIRCAM_F200W": [16,30]}

# ast_filters_inside_maglimits : integer
# Number of filters that must be within the magnitude limits
# for an AST to be included in the list (Default = 3)
ast_filters_inside_maglimits = 5

benjamin-gibson avatar Nov 21 '25 22:11 benjamin-gibson

Please fix the codestyle errors. I often just run the "black" auto-formatter to avoid any codestyle issues like this.

karllark avatar Nov 22 '25 16:11 karllark

Codecov Report

:x: Patch coverage is 2.70270% with 36 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 40.46%. Comparing base (b799489) to head (dd067c1).

Files with missing lines Patch % Lines
beast/observationmodel/ast/make_ast_input_list.py 2.85% 34 Missing :warning:
beast/tools/run/make_ast_inputs.py 0.00% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #847      +/-   ##
==========================================
- Coverage   40.55%   40.46%   -0.10%     
==========================================
  Files         107      107              
  Lines       10320    10346      +26     
==========================================
+ Hits         4185     4186       +1     
- Misses       6135     6160      +25     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Nov 22 '25 16:11 codecov[bot]