-
Notifications
You must be signed in to change notification settings - Fork 0
package management with Claude #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2958d54
Add Aqua.jl quality checks; all 8 checks pass
kdw503 dd179f3
Remove deprecated CenterIndexedArray(Type, dims) constructors
kdw503 52662fe
Add ExplicitImports.jl; make implicit imports explicit
kdw503 edf0fbd
Improve test coverage to 98.7%; remove dead iterate methods
kdw503 1d7d02f
Add module docstring; rewrite CenterIndexedArray docstring with full …
kdw503 915df33
Rewrite README with updated badges and verified jldoctest examples
kdw503 80921fb
Merge branch 'master' into dwk/mng
kdw503 9d5d0c0
set CI julia minimum version as 'min'
kdw503 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # runic formatting | ||
| 9006272 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,4 @@ | |
| *.jl.mem | ||
| deps/deps.jl | ||
| Manifest.toml | ||
| Manifest-v*.toml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,26 @@ | ||
| name = "CenterIndexedArrays" | ||
| uuid = "46a7138f-0d70-54e1-8ada-fb8296f91f24" | ||
| version = "1.0.0" | ||
| authors = ["Tim Holy <tim.holy@gmail.com>"] | ||
| version = "0.2.4" | ||
|
|
||
| [deps] | ||
| Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" | ||
| OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" | ||
|
|
||
| [compat] | ||
| Aqua = "0.8" | ||
| ExplicitImports = "1" | ||
| Interpolations = "0.11, 0.12, 0.13, 0.14, 0.15, 0.16" | ||
| OffsetArrays = "0.10, 0.11, 1" | ||
| julia = "1" | ||
| Random = "1" | ||
| Test = "1" | ||
| julia = "1.10" | ||
|
|
||
| [extras] | ||
| Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" | ||
| ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7" | ||
| Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
| Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
|
||
| [targets] | ||
| test = ["Random", "Test"] | ||
| test = ["Aqua", "ExplicitImports", "Random", "Test"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,98 @@ | ||
| # CenterIndexedArrays | ||
|
|
||
| [](https://travis-ci.org/HolyLab/CenterIndexedArrays.jl) | ||
| [](https://github.com/HolyLab/CenterIndexedArrays.jl/actions/workflows/CI.yml) | ||
| [](https://codecov.io/gh/HolyLab/CenterIndexedArrays.jl) | ||
| [](https://juliahub.com/ui/Packages/General/CenterIndexedArrays) | ||
| [](https://github.com/JuliaTesting/Aqua.jl) | ||
|
|
||
| A CenterIndexedArray is an array indexed symmetrically around its midpoint. | ||
| Here's a quick demo: | ||
| A `CenterIndexedArray` is an array indexed symmetrically around its midpoint: the center | ||
| element is always at index `(0, 0, …)`, and along each dimension of size `2n+1` the valid | ||
| indices run from `-n` to `n`. All dimension sizes must be odd. | ||
|
|
||
| A common use case is image registration, where the mismatch between two images is stored as | ||
| a function of their relative displacement — the center of that array is naturally the | ||
| zero-displacement case. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```julia | ||
| using Pkg | ||
| Pkg.add("CenterIndexedArrays") | ||
| ``` | ||
|
|
||
| ## Basic usage | ||
|
|
||
| ```jldoctest | ||
| julia> using CenterIndexedArrays | ||
|
|
||
| julia> A = CenterIndexedArray(reshape(1:15, 3, 5)) | ||
| 3×5 CenterIndexedArray(reshape(::UnitRange{Int64}, 3, 5)) with eltype Int64 with indices SymRange(1)×SymRange(2): | ||
| 1 4 7 10 13 | ||
| 2 5 8 11 14 | ||
| 3 6 9 12 15 | ||
|
|
||
| julia> A[0, 0] # the center point | ||
| julia> A[0, 0] # center element | ||
| 8 | ||
|
|
||
| julia> A[0, -1] | ||
| julia> A[0, -1] # one step left of center | ||
| 5 | ||
|
|
||
| julia> A[-1, 2] # one step above, two steps right | ||
| 13 | ||
| ``` | ||
|
|
||
| An example application is in image registration, to encode the mismatch between two images as you displace them relative to one another. | ||
| You can also allocate an uninitialized array: | ||
|
|
||
| The axes, `SymRange`, are symmetric ranges. They too are indexed symmetrically around 0: | ||
| ```jldoctest | ||
| julia> using CenterIndexedArrays | ||
|
|
||
| ```julia | ||
| julia> r = CenterIndexedArrays.SymRange(3) | ||
| julia> B = CenterIndexedArray{Float64}(undef, 3, 5); | ||
|
|
||
| julia> axes(B) | ||
| (SymRange(1), SymRange(2)) | ||
|
|
||
| julia> size(B) | ||
| (3, 5) | ||
| ``` | ||
|
|
||
| ## SymRange axes | ||
|
|
||
| The axes of a `CenterIndexedArray` are `SymRange` values — unit ranges symmetric around | ||
| zero. `SymRange(n)` covers `-n:n` and has length `2n+1`. | ||
|
|
||
| ```jldoctest | ||
| julia> using CenterIndexedArrays: SymRange | ||
|
|
||
| julia> r = SymRange(3) | ||
| SymRange(3) | ||
|
|
||
| julia> length(r) | ||
| 7 | ||
|
|
||
| julia> r[7] | ||
| ERROR: BoundsError: attempt to access 7-element SymRange with indices SymRange(3) at index [7] | ||
| Stacktrace: | ||
| [1] throw_boundserror(::SymRange, ::Int64) at ./abstractarray.jl:538 | ||
| [2] getindex(::SymRange, ::Int64) at /home/tim/.julia/dev/CenterIndexedArrays/src/symrange.jl:28 | ||
| [3] top-level scope at none:0 | ||
| julia> first(r), last(r) | ||
| (-3, 3) | ||
|
|
||
| julia> r[-3], r[3] | ||
| (-3, 3) | ||
| ``` | ||
|
|
||
| ## Interpolation | ||
|
|
||
| Wrapping an `Interpolations.jl` interpolation object enables fractional (sub-integer) | ||
| indexing, which is useful when computing cross-correlations at non-integer offsets. | ||
|
|
||
| ```jldoctest | ||
| julia> using CenterIndexedArrays, Interpolations | ||
|
|
||
| julia> dat = collect(reshape(1.0:25.0, 5, 5)); | ||
|
|
||
| julia> itp = interpolate(dat, BSpline(Linear())); | ||
|
|
||
| julia> A = CenterIndexedArray(itp); | ||
|
|
||
| julia> r[-3] | ||
| -3 | ||
| julia> A[0, 0] # center, equivalent to dat[3, 3] | ||
| 13.0 | ||
|
|
||
| julia> r[3] | ||
| 3 | ||
| julia> A[0.5, 0.0] # fractional index; linearly interpolated | ||
| 13.5 | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the motivation for deleting these that they're redundant with the generic method for
AbstractUnitRange? That's quite plausible, and deleting code is always nice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nvm I just saw edf0fbd. Wow, a good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Claude suggested this.