Skip to content

Commit dcb743f

Browse files
committed
update root branch name
1 parent fb86a49 commit dcb743f

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: CI
22
on:
3-
- push
4-
- pull_request
3+
push:
4+
branches: [main]
5+
tags: ["*"]
6+
pull_request:
7+
branches: [main]
58
jobs:
69
test:
710
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# PSFModels.jl
22

3-
[![Build Status](https://github.com/juliaastro/PSFModels.jl/workflows/CI/badge.svg?branch=master)](https://github.com/juliaastro/PSFModels.jl/actions)
3+
[![Build Status](https://github.com/juliaastro/PSFModels.jl/workflows/CI/badge.svg?branch=main)](https://github.com/juliaastro/PSFModels.jl/actions)
44
[![PkgEval](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/P/PSFModels.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html)
5-
[![Coverage](https://codecov.io/gh/juliaastro/PSFModels.jl/branch/master/graph/badge.svg?branch=master)](https://codecov.io/gh/juliaastro/PSFModels.jl)
5+
[![Coverage](https://codecov.io/gh/juliaastro/PSFModels.jl/branch/main/graph/badge.svg?branch=main)](https://codecov.io/gh/juliaastro/PSFModels.jl)
66
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
77

88
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliaastro.github.io/PSFModels.jl/stable)

docs/src/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ CurrentModule = PSFModels
55
# PSFModels.jl
66

77
[![GitHub](https://img.shields.io/badge/Code-GitHub-black.svg)](https://github.com/juliaastro/PSFModels.jl)
8-
[![Build Status](https://github.com/juliaastro/PSFModels.jl/workflows/CI/badge.svg?branch=master)](https://github.com/juliaastro/PSFModels.jl/actions)
8+
[![Build Status](https://github.com/juliaastro/PSFModels.jl/workflows/CI/badge.svg?branch=main)](https://github.com/juliaastro/PSFModels.jl/actions)
99
[![PkgEval](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/P/PSFModels.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html)
10-
[![Coverage](https://codecov.io/gh/juliaastro/PSFModels.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/juliaastro/PSFModels.jl)
10+
[![Coverage](https://codecov.io/gh/juliaastro/PSFModels.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/juliaastro/PSFModels.jl)
1111
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1212

1313
## Installation
@@ -54,7 +54,7 @@ PSFModels
5454

5555
## Benchmarks
5656

57-
The benchmarks can be found in the [`bench/`](https://github.com/JuliaAstro/PSFModels.jl/tree/master/bench) folder. To run them, first install the python dependencies
57+
The benchmarks can be found in the [`bench/`](https://github.com/JuliaAstro/PSFModels.jl/tree/main/bench) folder. To run them, first install the python dependencies
5858

5959
```
6060
$ pip install -r bench/requirements.txt

src/gaussian.jl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ f(x | x̂, Q) = exp[-4ln(2) * (x - x̂)ᵀ Q (x - x̂)]
2525
where `Q` is the inverse covariance matrix (or precision matrix). This is equivalent to the inverse of the FWHM matrix after squaring each element.
2626
"""
2727
struct Gaussian{T,FT,VT<:AbstractVector,IT<:Tuple} <: PSFModel{T}
28+
amp::T
2829
pos::VT
2930
fwhm::FT
3031
indices::IT
3132

32-
Gaussian{T}(pos::VT, fwhm::FT, indices::IT) where {T,VT<:AbstractVector,FT,IT<:Tuple} = new{T,FT,VT,IT}(pos, fwhm, indices)
33+
Gaussian{T}(amp::T, pos::VT, fwhm::FT, indices::IT) where {T,VT<:AbstractVector,FT,IT<:Tuple} = new{T,FT,VT,IT}(amp, pos, fwhm, indices)
3334
end
3435

3536
# Alias Normal -> Gaussian
@@ -45,36 +46,38 @@ const Normal = Gaussian
4546
# default type is Float64
4647
Gaussian(args...; kwargs...) = Gaussian{Float64}(args...; kwargs...)
4748
# parse indices from maxsize
48-
Gaussian{T}(pos::AbstractVector, fwhm; maxsize=3) where {T} = Gaussian{T}(pos, fwhm, indices_from_extent(pos, fwhm, maxsize))
49+
Gaussian{T}(pos::AbstractVector; fwhm, amp=one(T), maxsize=3) where {T} = Gaussian{T}(amp, pos, fwhm, indices_from_extent(pos, fwhm, maxsize))
4950
# default position is [0, 0]
50-
Gaussian{T}(fwhm; kwargs...) where {T} = Gaussian{T}(SA[0, 0], fwhm; kwargs...)
51+
Gaussian{T}(; kwargs...) where {T} = Gaussian{T}(SA[0, 0]; kwargs...)
5152
# # parse position to vector
52-
Gaussian{T}(x::Number, y::Number, fwhm; kwargs...) where {T} = Gaussian{T}(SA[x, y], fwhm; kwargs...)
53-
Gaussian{T}(xy::Tuple, fwhm; kwargs...) where {T} = Gaussian{T}(SVector(xy), fwhm; kwargs...)
53+
Gaussian{T}(x::Number, y::Number; kwargs...) where {T} = Gaussian{T}(SA[x, y]; kwargs...)
54+
Gaussian{T}(xy::Tuple; kwargs...) where {T} = Gaussian{T}(SVector(xy); kwargs...)
5455
# # translate polar coordinates to cartesian, optionally recentering
55-
Gaussian{T}(p::Polar, fwhm; origin=SA[0, 0], kwargs...) where {T} = Gaussian{T}(CartesianFromPolar()(p) .+ origin, fwhm; kwargs...)
56+
Gaussian{T}(p::Polar; origin=SA[0, 0], kwargs...) where {T} = Gaussian{T}(CartesianFromPolar()(p) .+ origin; kwargs...)
5657

5758
Base.size(g::Gaussian) = map(length, g.indices)
5859
Base.axes(g::Gaussian) = g.indices
5960

61+
const GAUSS_PRE = -4 * log(2)
62+
6063
# covers scalar case
6164
function (g::Gaussian{T})(point::AbstractVector) where T
6265
Δ = sqeuclidean(point, g.pos)
63-
val = exp(-4 * log(2) * Δ / g.fwhm^2)
66+
val = g.amp * exp(GAUSS_PRE * Δ / g.fwhm^2)
6467
return convert(T, val)
6568
end
6669
# covers vector case
6770
function (g::Gaussian{T,<:Union{Tuple,AbstractVector}})(point::AbstractVector) where T
6871
weights = SA[1/first(g.fwhm)^2, 1/last(g.fwhm)^2] # manually invert
6972
Δ = wsqeuclidean(point, g.pos, weights)
70-
val = exp(-4 * log(2) * Δ)
73+
val = g.amp * exp(GAUSS_PRE * Δ)
7174
return convert(T, val)
7275
end
7376

7477
# matrix case
7578
function (g::Gaussian{T,<:AbstractMatrix})(point::AbstractVector) where T
7679
R = point - g.pos
7780
Δ = R' * ((g.fwhm .^2) \ R)
78-
val = exp(-4 * log(2) * Δ)
81+
val = g.amp * exp(GAUSS_PRE * Δ)
7982
return convert(T, val)
8083
end

0 commit comments

Comments
 (0)