Skip to content

Add XSPEC model string macro (closes #187)#242

Open
aditya-pandey-dev wants to merge 1 commit intoJuliaAstro:mainfrom
aditya-pandey-dev:feature/xspec-model-strings
Open

Add XSPEC model string macro (closes #187)#242
aditya-pandey-dev wants to merge 1 commit intoJuliaAstro:mainfrom
aditya-pandey-dev:feature/xspec-model-strings

Conversation

@aditya-pandey-dev
Copy link
Copy Markdown

Implements bidirectional translation between XSPEC model strings and
XSPECModels.jl types, as requested in #187.

Changes

  • lib/XSPECModels/src/xspec_string.jl β€” new file:

    • parse_xspec_model_string(str): runtime XSPEC string β†’ Julia Expr
    • xspec"..." string macro: compile-time, zero overhead
    • xspec_model_string(model): reverse direction
    • XSPEC_MODEL_NAMES: 20 verified model mappings
  • lib/XSPECModels/src/XSPECModels.jl β€” include + export new API

  • lib/XSPECModels/test/test-xspec-string.jl β€” full test suite

  • lib/XSPECModels/test/runtests.jl β€” include new tests

  • docs/src/transitioning-from-xspec.md β€” complete guide for XSPEC users

  • docs/make.jl β€” add page to navigation

  • docs/src/models/xspec-models.md β€” mention new feature

  • running_example_xspec_strings.jl β€” self-contained demo

Example

model = xspec"phabs*powerlaw"
model = xspec"tbabs*(diskbb+powerlaw+gaussian)"

xspec_model_string(XS_PhotoelectricAbsorption() * XS_PowerLaw())
# "phabs*powerlaw"

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 2026

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 57.49%. Comparing base (62aba68) to head (8b69229).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #242      +/-   ##
==========================================
+ Coverage   55.69%   57.49%   +1.79%     
==========================================
  Files          39       39              
  Lines        2632     2550      -82     
==========================================
  Hits         1466     1466              
+ Misses       1166     1084      -82     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aditya-pandey-dev
Copy link
Copy Markdown
Author

@fjebaker I have raise a PR related to this issue can you please review the PR

@fjebaker
Copy link
Copy Markdown
Member

Hello @aditya-pandey-dev thanks for your PR! I am away at a conference this week so it will take me some time to review this.

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