Skip to content

Refactor plotting recipes and add comprehensive test suite for Issue #29#72

Open
Alisha1701 wants to merge 6 commits intoStingraySoftware:mainfrom
Alisha1701:feature/plotting-recipes-refactor
Open

Refactor plotting recipes and add comprehensive test suite for Issue #29#72
Alisha1701 wants to merge 6 commits intoStingraySoftware:mainfrom
Alisha1701:feature/plotting-recipes-refactor

Conversation

@Alisha1701
Copy link
Copy Markdown

This PR implements lightweight plotting recipes using RecipesBase.jl to resolve Issue #29. By using recipes instead of direct Plots.jl calls, we keep the package dependencies minimal while providing powerful visualization tools.

Key Features:

EventList Recipes: Automatic binning into lightcurves with :steppre (staircase) formatting.

GTI Shading: Vertical green spans (vspan) automatically appear when show_gtis=true is passed, utilizing meta.gti data.

LightCurve Recipes: Support for automatic error bar rendering using the count_error field.

New Test Suite: Added test/test_plotting.jl which achieves 100% coverage for the new recipes, ensuring stability for future releases.

Note on Testing: During local verification on Julia 1.12, I encountered a macro error in test_fourier.jl related to ResumableFunctions. I have isolated the Plotting tests to ensure this PR remains unblocked while that separate issue is investigated.

Comment thread src/plotting_recipes.jl Outdated
end

return lc.time, lc.counts
end No newline at end of file
Copy link
Copy Markdown
Member

@kashish2210 kashish2210 Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will also suggest here once perform local graph creation see this comment, how you can set up

@kashish2210
Copy link
Copy Markdown
Member

@Alisha1701, thanks for ur PR try to run local tests

@Alisha1701
Copy link
Copy Markdown
Author

i have add new line in the plotting_recipes.jl
and verified the local graph creation,tested the new plotting recipes using the NICER mission dataset (ni1200120104_0mpu7_cl.evt)

Screenshot from 2026-02-24 17-47-04 Screenshot from 2026-02-24 17-48-09

@kashish2210
Copy link
Copy Markdown
Member

@Alisha1701 this looks fine to let's see what are the reviews of @matteobachetti and @fjebaker

@kashish2210
Copy link
Copy Markdown
Member

One more thing what methods are you using for gti filtering?

@Alisha1701
Copy link
Copy Markdown
Author

In the EventList recipe, I use a loop to iterate through events.meta.gti and apply @Series with :vspan
For LightCurve objects, the recipe looks for GTI boundaries within the lc.metadata.extra["gti"] field.

@kashish2210
Copy link
Copy Markdown
Member

kashish2210 commented Feb 24, 2026

Ohh great @Alisha1701 So we have some more good functions avilable in gti.jl you may lookout them and you may consider these blogs : to get idea of documentations about gti and recipes

Copy link
Copy Markdown
Member

@kashish2210 kashish2210 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Alisha1701 thanks for updates I have left some comments you may go through this

Comment thread Project.toml Outdated
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FITSIO = "525bcba6-941b-5504-bd06-fd0dc1a4d2eb"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the pkg for the kernel we don't need this at moment

Comment thread Project.toml Outdated
FFTW = "1.4"
FITSIO = "0.16"
HDF5 = "0.16"
IJulia = "1.34.3"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above referenced

Comment thread src/Stingray.jl
export split_by_gtis

include("plotting_recipes.jl")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can make one separate folder for example plotting/plotting _recpies_lightcureve.jl
To be more convenient for dev

Comment thread src/plotting_recipes.jl Outdated
@@ -0,0 +1,87 @@
using RecipesBase
using Statistics
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U can put using in stingray.jl

Comment thread src/plotting_recipes.jl Outdated
ylabel --> "Counts"
seriestype --> :steppre

# FIX: Use lc.count_error instead of lc.errors
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U can remove redundant comments;)

Comment thread test/runtests.jl Outdated
using Random

include("test_fourier.jl")
# include("test_fourier.jl")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U can remove this comment

Comment thread test/test_plotting.jl Outdated
@@ -0,0 +1,36 @@
using Stingray
using Plots
using Test
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still the same thing u can put these using imports in runtest.jl :)

Comment thread test/test_plotting.jl Outdated
lc_no_gti = create_lightcurve(EventList(times, energies), 1.0)
@test_nowarn plot(lc_no_gti)
end
end No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you follow the structure that are being used in the stingray.jl
let - end blocks

@Alisha1701 Alisha1701 force-pushed the feature/plotting-recipes-refactor branch from 6f41608 to 6114a8b Compare March 30, 2026 14:45
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.

3 participants