Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Power colours #11

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@ 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"
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
FITSIO = "525bcba6-941b-5504-bd06-fd0dc1a4d2eb"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568"
ResumableFunctions = "c5292f4c-5179-55e1-98c5-05642aab7184"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
DataFrames = "1.3"
Distributions = "0.25"
julia = "1.11"
FFTW = "1.4"
Distributions = "0.25"
Expand All @@ -26,11 +35,21 @@ ProgressBars = "1.4"
DataFrames = "1.3"
HDF5 = "0.16"
FITSIO = "0.16"
HDF5 = "0.16"
Intervals = "1.8"
JuliaFormatter = "1.0.62"
NaNMath = "0.3, 1"
Plots = "1.8"
ProgressBars = "1.4"
ResumableFunctions = "0.6"
StatsBase = "0.33"
Test = "1.11.0"
julia = "1.7"

[extras]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
ResumableFunctions = "c5292f4c-5179-55e1-98c5-05642aab7184"

[targets]
test = ["Test"]
test = ["Test", "Random","ResumableFunctions"]
26 changes: 26 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,29 @@ Documentation for [Stingray](https://github.com/matteobachetti/Stingray.jl).
```@autodocs
Modules = [Stingray]
```
## Overview
**Stingray.jl** is a Julia package for **X-ray spectral timing analysis**, designed for high-performance astrophysical data processing.


## Get Started
🚀 **New to Stingray.jl?** Follow these steps:

1. **[Installation Guide](installation.md)** → Set up Stingray.jl.
2. **[Usage Guide](usage.md)** → Learn how to analyze time-series data.

## Quick Example
Here's a simple example to analyze an X-ray light curve:
```julia
using Stingray, Random, Plots

# Generate Simulated Light Curve
N = 1024 # Number of data points
t = collect(0:0.1:(N-1)*0.1) # Time array
Random.seed!(42)
light_curve = sin.(2π * 0.5 .* t) + 0.3 * randn(N) # Sine wave + noise

# Plot Light Curve
plot(t, light_curve, label="Simulated Light Curve", xlabel="Time (s)", ylabel="Intensity", title="X-ray Light Curve", legend=:topright)
```

🚀 **Start exploring Stingray.jl today!**
196 changes: 196 additions & 0 deletions docs/src/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
```@meta
CurrentModule = Stingray
```

# Stingray

Documentation for [Stingray](https://github.com/matteobachetti/Stingray.jl).

```@index
```

```@autodocs
Modules = [Stingray]
```
# Stingray.jl

Stingray.jl is a spectral-timing software package for time series analysis of astronomical data, with a particular focus on X-ray astronomy.

## Installation

### Prerequisites

Before installing Stingray.jl, ensure you have Julia v1.7 or later installed:

1. Download Julia from the [official website](https://julialang.org/downloads/)
2. Follow the installation instructions for your operating system
3. Verify your installation by running `julia --version` in your terminal

### Installing from the Julia General Registry

To install the stable version of Stingray.jl:

```julia
using Pkg
Pkg.add("Stingray")
```

### Installing the Development Version

For the latest features and improvements, you can install directly from the GitHub repository:

```julia
using Pkg
Pkg.add(url="https://github.com/matteobachetti/Stingray.jl")
```

Or switch to development mode if you plan to contribute:

```julia
using Pkg
Pkg.develop("Stingray")
```

### Verifying Installation

Verify your installation works correctly:

```julia
using Stingray
@info "Stingray.jl loaded successfully!"
```

## Testing

Stingray.jl includes a comprehensive test suite to ensure functionality. To run the tests:

```julia
using Pkg
Pkg.test("Stingray")
```

For contributors working on a local development version:

```julia
# Navigate to the package directory
cd(joinpath(Pkg.devdir(), "Stingray"))

# Run tests
using Pkg
Pkg.test()
```

### Writing New Tests

When adding features or fixing bugs, please include appropriate tests:

1. Tests should be placed in the `test/` directory
2. Use the `@testset` macro to organize related tests
3. Follow existing naming conventions (e.g., `test_[module_name].jl` or `test_[feature].jl`)
4. Run tests locally before submitting a pull request

Example test structure:

```julia
@testset "Module Name Tests" begin
@test function_to_test(input) == expected_output
@test_throws ErrorType function_to_test(invalid_input)
end
```

## Documentation

### Building Documentation Locally

To build and preview the documentation locally:

1. Install required documentation packages:

```julia
using Pkg
Pkg.add(["Documenter", "DocumenterTools"])
```

2. Navigate to the docs directory and build:

```julia
cd("docs")
julia --project=. make.jl
```

3. Open `docs/build/index.html` in your browser

### Writing Documentation

Documentation uses [Documenter.jl](https://juliadocs.github.io/Documenter.jl/stable/). When adding new features:

1. Add docstrings to functions, types, and modules following Julia's documentation guidelines
2. Use `"""..."""` for multi-line docstrings
3. Include Examples section with working code examples
4. For complex features, add a dedicated page in `docs/src/`

Example docstring:

```julia
"""
power_color(frequency, power; kwargs...)

Calculate two power colors from a power spectrum.

# Arguments
- `frequency::Vector{Number}`: The frequencies of the power spectrum
- `power::Vector{Number}`: The power at each frequency

# Keywords
- `power_err=nothing`: Optional error measurements for power
- `freq_edges=[1/256, 1/32, 0.25, 2.0, 16.0]`: Frequency edges for calculations
- `return_log=false`: Return the base-10 logarithm of results

# Returns
- `pc0::Number`: The first power color
- `pc0_err::Number`: Error on the first power color
- `pc1::Number`: The second power color
- `pc1_err::Number`: Error on the second power color

# Examples
```julia
freq = collect(0.01:0.01:20)
power = 1 ./ freq
pc0, pc0_err, pc1, pc1_err = power_color(freq, power)
```

See Heil et al. 2015, MNRAS, 448, 3348 for details.
"""
function power_color(frequency, power; kwargs...)
# Implementation
end
```

## Example Notebooks

Example Jupyter notebooks demonstrating Stingray.jl functionality are available in the [notebooks repository](https://github.com/kashish2210/notebooks).

These examples cover:
- Basic time series analysis
- Power spectral calculations
- Cross-spectral techniques
- Specialized techniques for X-ray astronomy

## Contributing

We welcome contributions! Please check the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines.

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Implement your changes with tests and documentation
4. Commit your changes (`git commit -m 'Add amazing feature'`)
5. Push to your branch (`git push origin feature/amazing-feature`)
6. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

Stingray.jl is a port of the Python [Stingray](https://github.com/StingraySoftware/stingray) package with optimizations for Julia.
Loading