You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/index.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,12 +28,12 @@ To import the library
28
28
julia>using PSFModels
29
29
```
30
30
31
-
None of the models are exported to avoid namespace clashes, but it can be verbose. You can either import names directly
31
+
None of the models are exported to avoid namespace clashes, but it can be verbose to continuously rewrite `PSFModels`. You can either import names directly
32
32
33
33
```julia
34
34
julia>using PSFModels: Gaussian
35
35
36
-
julia> model =Gaussian(8)
36
+
julia> model =Gaussian(fwhm=8)
37
37
```
38
38
39
39
or you can create an alias for `PSFModels`
@@ -43,9 +43,9 @@ or you can create an alias for `PSFModels`
In general, the PSFs have a position, a full-width at half-maximum (FWHM) measure, and an amplitude. The position a 1-based pixel coordinate system, where `(1, 1)` represents the *center* of the bottom left pixel. This matches the indexing style of Julia as well as DS9, IRAF, SourceExtractor, and WCS. If a position is not specified, it is set to `(0, 0)`. The FWHM is a consistent scale parameter for the models. All models support a scalar (isotropic) FWHM and a FWHM for each axis (diagonal).
15
+
In general, the PSFs have a position, a full-width at half-maximum (FWHM) measure, and an amplitude. The position follows a 1-based pixel coordinate system, where `(1, 1)` represents the *center* of the bottom left pixel. This matches the indexing style of Julia as well as DS9, IRAF, SourceExtractor, and WCS. If a position is not specified, it is set to `(0, 0)`. The FWHM is a consistent scale parameter for the models. All models support a scalar (isotropic) FWHM and a FWHM for each axis (diagonal).
16
16
17
17
## Usage
18
18
19
-
Using the models should feel just like an array. In fact, `PSFModels.PSFModel <: AbstractMatrix`. However, no data is stored and no allocations have to be made. In other words, representing the models as matrices is merely a convenience, since typically astronomical data is stored in dense arrays.
19
+
Using the models should feel just like an array. In fact, `PSFModels.PSFModel <: AbstractMatrix`. However, no data is stored and no allocations have to be made. In other words, representing the models as matrices is merely a convenience, since typically astronomical data is stored in dense arrays. Another way of thinking of these is a lazy array that applies a function when indexed, rather than returning data stored in memory.
20
20
21
21
```jldoctest model
22
-
julia> m = PSFModels.Gaussian(5); # fwhm of 5 pixels, centered at (0, 0)
22
+
julia> m = PSFModels.Gaussian(fwhm=3); # centered at (0, 0)
It's important to note the difference in the axis ordering between the index-style calls and the function-style calls. The index-style calls are reverse cartesian order (e.g., `(z, y, x)`), while function calls are the typical cartesian order `(x, y, z)`. Regardless, the constructors are always in cartesian order (`(x, y, z)`).
34
35
35
-
Because the model is a matrix, it needs to have a size. In this case, the size is `maxsize * FWHM` pixels, centered around the origin, and rounded up. We can see how this alters the indices from a typical `Matrix`
36
+
Because the model is a matrix, it needs to have a size. Each model has a bounding box which can be controlled with the `extent` keyword. By default the extent is set by a scalar factor of the FWHM (e.g., `maxsize * FWHM` pixels), centered around the PSF, and rounded up. We can see how this alters the indices from a typical `Matrix`
36
37
37
38
```jldoctest model
38
-
julia> size(m)
39
-
(17, 17)
39
+
julia> size(m) # default 'stamp' size is fwhm * 3
40
+
(11, 11)
40
41
41
42
julia> axes(m)
42
-
(-8:8, -8:8)
43
+
(-5:5, -5:5)
43
44
```
44
45
45
46
if we want to collect the model into a dense matrix, regardless of the indexing (e.g. to prepare for cross-correlation), we can simply
46
47
47
48
```jldoctest model
48
49
julia> stamp = collect(m);
50
+
49
51
```
50
52
51
53
these axes are merely a convenience for bounding the model, since they accept any real number as input.
Nice- we only had to reduce ~50 pixels instead of ~10,000 to calculate the aperture sum, all in under a microsecond (on my machine).
90
+
Nice- we only had to reduce ~50 pixels instead of ~1,000,000 to calculate the aperture sum, all in under a microsecond (on my machine).
87
91
88
92
Since the models are lazy, that means the type of the output can be specified, as long as it can be converted to from a real number (so no integer types).
finally, we provide plotting recipes from [RecipesBase.jl](https://github.com/JuliaPlots/RecipesBase.jl), which can be seen in use in the [API/Reference](@ref) section.
@@ -100,16 +105,9 @@ finally, we provide plotting recipes from [RecipesBase.jl](https://github.com/Ju
100
105
using Plots
101
106
model = PSFModels.Gaussian(8)
102
107
plot(model) # default axes
103
-
plot(model, 1:5, 1:5) # custom axes
108
+
plot(model, :, 1:5) # custom axes (y, x)
104
109
plot(model, axes(other)) # use axes from other array
105
110
```
106
-
107
-
!!! tip "Tip: Automatic Differentation"
108
-
Forward-mode AD libraries tend to use dual numbers, which can cause headaches getting the types correct. We recommend using the *primal vector*'s element type to avoid these headaches
109
-
```julia
110
-
# example generative model for position and scalar fwhm
111
-
model(X::AbstractVector{T}) where {T} = PSFModels.Gaussian{T}(X...)
0 commit comments