From 1c536e203ebeba89ce3cf0f4145a0e3530764f36 Mon Sep 17 00:00:00 2001 From: JawadAhmadCS Date: Fri, 21 Mar 2025 13:18:59 +0500 Subject: [PATCH 1/2] Add docs for initial setup and contributionn --- docs/Project.toml | 2 +- docs/make.jl | 10 ++++++---- docs/src/index.md | 45 ++++++++++++++++++++++++++++++++++++++------- 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index 3a52a5d..fb315d1 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,4 +2,4 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" [compat] -Documenter = "0.27" +Documenter = "0.27" \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index d6909e2..c908c02 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -6,11 +6,11 @@ DocMeta.setdocmeta!(Stingray, :DocTestSetup, :(using Stingray); recursive=true) makedocs(; modules=[Stingray], authors="Aman Pandey", - repo="https://github.com/matteobachetti/Stingray.jl/blob/{commit}{path}#{line}", + repo=Remotes.GitHub("StingraySoftware", "Stingray.jl"), sitename="Stingray.jl", format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", - canonical="https://github.com/matteobachetti/Stingray.jl", + canonical="https://github.com/StingraySoftware/Stingray.jl", edit_link="master", assets=String[], ), @@ -20,6 +20,8 @@ makedocs(; ) deploydocs(; - repo="https://github.com/matteobachetti/Stingray.jl", + repo="https://github.com/StingraySoftware/Stingray.jl", devbranch="main", -) + target="build", + push_preview=true +) \ No newline at end of file diff --git a/docs/src/index.md b/docs/src/index.md index 1a3c5c3..dc08aac 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,14 +1,45 @@ -```@meta -CurrentModule = Stingray +# Installing Development Environment (For New Contributors) + +For those of you wanting to contribute to the project, install the bleeding-edge development version from source. First, fork our repository on GitHub and clone the forked repository using: + +```sh +$ git clone --recursive https://github.com//stingray.jl.git +``` + +Now, navigate to this folder and run the following command to add an upstream remote that’s linked to Stingray’s main repository. (This will be necessary when submitting PRs later.): + +```sh +$ cd stingray.jl +$ git remote add upstream https://github.com/StingraySoftware/stingray.jl.git ``` -# Stingray +# Installation +### Setting up in VS Code + +1. Open Julia REPL + - Press `Ctrl + Shift + P` + - Search for `julia:start REPL` and select it +2. Navigate to the Cloned Repository in REPL: -Documentation for [Stingray](https://github.com/matteobachetti/Stingray.jl). +```julia +cd("C:\\Users\\Stingray.jl") +``` + +3. Activate and Install Dependencies: -```@index +```julia +import Pkg +Pkg.activate(".") +Pkg.instantiate() ``` -```@autodocs -Modules = [Stingray] +## Test Suite + +Please be sure to run the test suite before you use the package, and report anything you think might be bugs on our GitHub Issues page. + +```julia +using Pkg +Pkg.test("Stingray") ``` + + From d73a60bf4dd4188372c74d188a504b303a8c7bda Mon Sep 17 00:00:00 2001 From: JawadAhmadCS Date: Fri, 21 Mar 2025 15:09:56 +0500 Subject: [PATCH 2/2] add overview,Features and Future Plan in docs --- .github/workflows/CI.yml | 18 +++++------ Project.toml | 34 ++++++++++----------- docs/make.jl | 2 +- docs/src/index.md | 37 ++++++++++++++++++++-- src/Stingray.jl | 2 +- src/fourier.jl | 66 +++++++++++++++++----------------------- test/runtests.jl | 3 +- test/test_fourier.jl | 7 +++-- 8 files changed, 95 insertions(+), 74 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 57128dd..1dba6d8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,25 +18,22 @@ jobs: fail-fast: false matrix: version: - - '1.7' - - 'nightly' + - '1.11' os: - ubuntu-latest - - macOS-latest - - windows-latest arch: - x64 steps: - - uses: actions/checkout@v3 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v5 with: files: lcov.info docs: @@ -45,10 +42,11 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v3 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: version: '1' + - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-docdeploy@v1 env: diff --git a/Project.toml b/Project.toml index cd910a8..a91688b 100644 --- a/Project.toml +++ b/Project.toml @@ -4,32 +4,32 @@ authors = ["Aman Pandey"] version = "0.1.0" [deps] -FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" -Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" -ResumableFunctions = "c5292f4c-5179-55e1-98c5-05642aab7184" -StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" -Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -Metadata = "4fb893c1-3164-4f58-823a-cb4c64eabb4f" -HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" -NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" +Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" +FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" FITSIO = "525bcba6-941b-5504-bd06-fd0dc1a4d2eb" +HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5" +NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" +ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568" +ResumableFunctions = "c5292f4c-5179-55e1-98c5-05642aab7184" +Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" +Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" [compat] -julia = "1.7" -FFTW = "1.4" -Distributions = "0.25" -ResumableFunctions = "0.6" -StatsBase = "0.33" -ProgressBars = "1.4" DataFrames = "1.3" -Metadata = "0.3" -HDF5 = "0.16" +Distributions = "0.25" +FFTW = "1.4" FITSIO = "0.16" +HDF5 = "0.16" Intervals = "1.8" NaNMath = "0.3, 1" +ProgressBars = "1.4" +ResumableFunctions = "0.6" +Revise = "3.7.2" +StatsBase = "0.33" +julia = "1.11" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/docs/make.jl b/docs/make.jl index c908c02..7412263 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -24,4 +24,4 @@ deploydocs(; devbranch="main", target="build", push_preview=true -) \ No newline at end of file +) diff --git a/docs/src/index.md b/docs/src/index.md index dc08aac..52b38aa 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,3 +1,36 @@ +## Stingray: Next-Generation Spectral Timing +# Overview + +Stingray is a Julia library designed to perform time series analysis and related tasks on astronomical light curves. It supports a range of commonly used Fourier analysis techniques, as well as extensions for analyzing pulsar data, simulating datasets, and statistical modeling. Stingray is designed to be easy to extend and incorporate into data analysis workflows and pipelines. + +# Features + +## Current Capabilities + +### 1. Data Handling and Simulation + +- Good Time Interval (GTI) operations + +### 2. Fourier Methods + +- Basic Fourier transformations + +### 3. Testing Framework + +- Includes test cases for GTI and Fourier transformations +- Sample event list data for validation + +## Future Plans + +We welcome feature requests! If you need a particular tool that is not currently available or have a new method that could be useful in Stingray.jl, please contribute or open an issue. + +### Upcoming Features + +- **Power spectra calculations** +- **Extended power spectra and cross spectra support** +- **More comprehensive time series operations** +- **Advanced pulsar search methods** + # Installing Development Environment (For New Contributors) For those of you wanting to contribute to the project, install the bleeding-edge development version from source. First, fork our repository on GitHub and clone the forked repository using: @@ -40,6 +73,4 @@ Please be sure to run the test suite before you use the package, and report anyt ```julia using Pkg Pkg.test("Stingray") -``` - - +``` \ No newline at end of file diff --git a/src/Stingray.jl b/src/Stingray.jl index 740e849..d8bd360 100644 --- a/src/Stingray.jl +++ b/src/Stingray.jl @@ -1,7 +1,7 @@ module Stingray using ResumableFunctions, StatsBase, Statistics, DataFrames -using FFTW, Metadata, NaNMath, FITSIO, Intervals +using FFTW, NaNMath, FITSIO, Intervals using ProgressBars: tqdm as show_progress include("fourier.jl") diff --git a/src/fourier.jl b/src/fourier.jl index 07e12f5..0ede925 100644 --- a/src/fourier.jl +++ b/src/fourier.jl @@ -333,15 +333,10 @@ function avg_pds_from_iterable(flux_iterable, dt::Real; norm::String="frac", results[!,"freq"] = freq results[!,"power"] = cross results[!,"unnorm_power"] = unnorm_cross - results = attach_metadata(results,(n= n_bin, m= n_ave, dt= dt, - norm= norm, - df= 1 / (dt * n_bin), - nphots= n_ph, - mean= common_mean, - variance= common_variance, - segment_size= dt * n_bin)) - + results = (; results , n = n_bin, m = n_ave, dt, norm, df = 1 / (dt * n_bin), nphots = n_ph, setment_size = dt * n_bin, mean = common_mean, variance = common_variance) + results = DataFrame(results.results) return results + end function avg_cs_from_iterables_quick(flux_iterable1 ,flux_iterable2, @@ -429,18 +424,14 @@ function avg_cs_from_iterables_quick(flux_iterable1 ,flux_iterable2, results[!,"freq"] = freq results[!,"power"] = cross results[!,"unnorm_power"] = unnorm_cross - results = attach_metadata(results,(n= n_bin, m= n_ave, dt= dt, - norm= norm, - df= 1 / (dt * n_bin), - nphots= n_ph, - nphots1= n_ph1, nphots2= n_ph2, - variance= nothing, - mean= common_mean, - mean1= common_mean1, - mean2= common_mean2, - power_type= "all", - fullspec= false, - segment_size= dt * n_bin)) + results = (; results, n = n_bin, m = n_ave, dt, norm, df = 1 / (dt * n_bin), + nphots = n_ph, nphots1 = n_ph1, nphots2 = n_ph2, + variance = nothing, mean = common_mean, mean1 = common_mean1, + mean2 = common_mean2, power_type = "all", fullspec = false, + segment_size = dt * n_bin) + results = DataFrame(results.results) + + return results end @@ -671,22 +662,16 @@ function avg_cs_from_iterables( results[!,"unnorm_pds2"] = unnorm_pds2 end - results = attach_metadata(results,(n= n_bin, m= n_ave, dt= dt, - norm= norm, - df= 1 / (dt * n_bin), - segment_size= dt * n_bin, - nphots= n_ph, - nphots1= n_ph1, nphots2= n_ph2, - countrate1= common_mean1 / dt, - countrate2= common_mean2 / dt, - mean= common_mean, - mean1= common_mean1, - mean2= common_mean2, - power_type= power_type, - fullspec= fullspec, - variance= common_variance, - variance1= common_variance1, - variance2= common_variance2)) + results = (; results, n = n_bin, m = n_ave, dt, norm, df = 1 / (dt * n_bin), + segment_size = dt * n_bin, nphots = n_ph, nphots1 = n_ph1, + nphots2 = n_ph2, countrate1 = common_mean1 / dt, + countrate2 = common_mean2 / dt, mean = common_mean, + mean1 = common_mean1, mean2 = common_mean2, power_type, + fullspec, variance = common_variance, variance1 = common_variance1, + variance2 = common_variance2) + results = DataFrame(results.results) + + return results @@ -708,9 +693,12 @@ function avg_pds_from_events(times:: AbstractVector{<:Real}, gti::AbstractMatrix cross = avg_pds_from_iterable(flux_iterable, dt, norm=norm, use_common_mean=use_common_mean, silent=silent) + if !isnothing(cross) - attach_metadata(cross,(gti=gti,)) + cross = (; cross, gti=gti) + cross = DataFrame(cross.cross) end + return cross end @@ -765,7 +753,9 @@ function avg_cs_from_events(times1:: AbstractVector{<:Real}, times2:: AbstractVe ) end if !isnothing(results) - attach_metadata(results,(gti=gti,)) + results = (; results, gti=gti) + results = DataFrame(results.results) end + return results end diff --git a/test/runtests.jl b/test/runtests.jl index a4460f4..287371b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,5 @@ using Stingray using Test -using FFTW, Distributions, Statistics, StatsBase, Metadata, HDF5 - +using FFTW, Distributions, Statistics, StatsBase, HDF5 include("test_fourier.jl") include("test_gti.jl") diff --git a/test/test_fourier.jl b/test/test_fourier.jl index 8008790..38de843 100644 --- a/test/test_fourier.jl +++ b/test/test_fourier.jl @@ -26,9 +26,12 @@ function compare_tables(table1, table2; rtol=0.001, discard = []) end end - table1 = Metadata.drop_metadata(table1) - table2 = Metadata.drop_metadata(table2) + data_fields_table1 = filter(field -> !(typeof(field) == Symbol && startswith(string(field), "meta")), names(table1)) + data_fields_table2 = filter(field -> !(typeof(field) == Symbol && startswith(string(field), "meta")), names(table2)) + + + for field in names(table1) if field in discard continue