Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f6414bd
Update package installation commands in docsBuild.yml
JaredW40 Dec 21, 2025
1af52d5
Update Julia version in docsBuild workflow
JaredW40 Dec 21, 2025
7c042eb
Add FourierFilterFlux dependency to Project.toml
JaredW40 Dec 21, 2025
53ba98c
Update Julia version in docsBuild workflow
JaredW40 Dec 21, 2025
640dc74
Regenerate docs manifest
JaredW40 Dec 21, 2025
42587bd
Update project files
JaredW40 Dec 21, 2025
e67b664
Merge branch 'master' of https://github.com/JaredW40/FourierFilterFlu…
JaredW40 Dec 21, 2025
2167eb5
Regenerate docs manifest for Julia 1.10
JaredW40 Dec 21, 2025
9dd82d5
Regenerate docs manifest for Julia 1.12
JaredW40 Dec 21, 2025
50ca206
Update Project.toml
JaredW40 Dec 21, 2025
15b8b51
Update docsBuild.yml
JaredW40 Dec 21, 2025
f0b4776
Update docsBuild.yml
JaredW40 Dec 21, 2025
7999d5c
Update Project.toml
JaredW40 Dec 21, 2025
42dfd30
Update FourierFilterFlux.jl
JaredW40 Dec 21, 2025
ef9eb3f
Add Functors dependency and fix FFTW plan handling
JaredW40 Dec 21, 2025
1c4ae60
Update coreType.md
JaredW40 Dec 21, 2025
926b9b9
Update paramCollection.jl
JaredW40 Dec 21, 2025
d5ad5b1
Update coreType.md
JaredW40 Dec 21, 2025
a15f3fe
Update CI.yml
JaredW40 Dec 21, 2025
3c4d0dd
Update CI.yml
JaredW40 Dec 21, 2025
d790dc1
Update CI.yml
JaredW40 Dec 21, 2025
54ba2e7
Add files via upload
JaredW40 Dec 21, 2025
d259a48
Merge pull request #5 from JaredW40/master
BoundaryValueProblems Dec 21, 2025
fb234d3
Merge branch 'dsweber2:master' into master
BoundaryValueProblems Dec 21, 2025
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
30 changes: 16 additions & 14 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,33 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1.10'
- '1.12'
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
exclude:
- os: macOS-latest
arch: x64
include:
- os: macOS-latest
arch: aarch64
version: '1.10'
- os: macOS-latest
arch: aarch64
version: '1.12'
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- 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@v1
- uses: codecov/codecov-action@v4
with:
file: lcov.info
12 changes: 7 additions & 5 deletions .github/workflows/docsBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: '1.7'
version: '1.12'
- name: Install dependencies
run: |
sudo apt install libxt6 libxrender1 libxext6 libgl1-mesa-glx libqt5widgets5
- run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libxt6 libxrender1 libxext6 libgl1 libqt5widgets5
- name: Install Julia dependencies
run: |
julia --project=docs -e '
using Pkg
Pkg.instantiate()
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- name: Build and deploy
run: julia --project=docs docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
run: julia --project=docs docs/make.jl
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FourierFilterFlux"
uuid = "3d7dfd45-6c90-4c9b-b697-194a05757159"
authors = ["dsweber2"]
version = "0.3.7"
authors = ["dsweber2"]

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand All @@ -11,6 +11,7 @@ ContinuousWavelets = "96eb917e-2868-4417-9cb6-27e7ff17528f"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Expand All @@ -20,6 +21,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd"

[compat]
Functors = "0.5.2"
julia = "1.10"

[extras]
Expand Down
3 changes: 2 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ ContinuousWavelets = "96eb917e-2868-4417-9cb6-27e7ff17528f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
FourierFilterFlux = "3d7dfd45-6c90-4c9b-b697-194a05757159"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

[compat]
Documenter = "0.27"
Documenter = "1"
35 changes: 21 additions & 14 deletions docs/src/coreType.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ julia> w[55:60,2] = randn(6);
julia> ŵ = rfft(w, 1);

julia> W = ConvFFT(ŵ,nothing,(128,1,2))
ConvFFT[input=((128,), nfilters = 2, σ=identity, bc=Periodic()]
ConvFFT[input=((128,), nfilters = 2, σ=identity, bc=Periodic()] # 130 parameters

```

Expand Down Expand Up @@ -72,8 +72,8 @@ address this, e.g. `Pad(6)`
```jldoctest 1DconvEx
julia> W = ConvFFT(ŵ,nothing,(128,1,2),boundary= FourierFilterFlux.Pad(6))
┌ Warning: You didn't hand me a set of filters constructed with the boundary in mind. I'm going to adjust them to fit, this may not be what you intended
└ @ FourierFilterFlux ~/allHail/projects/FourierFilterFlux/src/FourierFilterFlux.jl:148
ConvFFT[input=((128,), nfilters = 2, σ=identity, bc=Pad(6,)]
└ @ FourierFilterFlux ~/work/FourierFilterFlux.jl/FourierFilterFlux.jl/src/FourierFilterFlux.jl:180
ConvFFT[input=((128,), nfilters = 2, σ=identity, bc=Pad(6,)] # 142 parameters

julia> r =W(x); size(r)
(128, 2, 1, 2)
Expand All @@ -93,7 +93,7 @@ do that as well:
julia> ex2Dsize = (127, 352, 1, 10);

julia> filt = ConvFFT(ex2Dsize, 3, relu, trainable=true,bias=false)
ConvFFT[input=((127, 352), nfilters = 3, σ=relu, bc=Periodic()]
ConvFFT[input=((127, 352), nfilters = 3, σ=relu, bc=Periodic()] # 67_584 parameters

```

Expand All @@ -118,20 +118,24 @@ julia> fitThis = zeros(64,352,3); fitThis[1:3,(176-3:176+3),1] .= 1;
julia> fitThis[1:15,(176-15:176+15),2] .= 1; fitThis[1:32,(176-44:176+44),3] .= 1;

julia> targetConv = ConvFFT(fitThis, nothing, (127,352,1,10))
ConvFFT[input=((127, 352), nfilters = 3, σ=identity, bc=Periodic()]
ConvFFT[input=((127, 352), nfilters = 3, σ=identity, bc=Periodic()] # 67_584 parameters

julia> sum(norm.(map(-, targetConv.weight, filt.weight)) .^ 2) / sum(norm.(targetConv.weight) .^ 2) # the relative error
1.0038243395792357
1.0039214694920346

julia> loss(x,y) = norm(filt(x) - targetConv(x))
julia> loss(m, x) = norm(m(x) - targetConv(x))
loss (generic function with 1 method)

julia> genEx(n) = [(cpu(randn(ex2Dsize)), true) for i=1:n];
julia> genEx(n) = [cpu(randn(ex2Dsize)) for i=1:n];

julia> Flux.train!(loss, Flux.params(filt), genEx(100), ADAM()) # train for 100 samples
julia> opt = Flux.setup(Adam(), filt);

julia> for x in genEx(100)
Flux.train!(loss, filt, [(x,)], opt)
end

julia> sum(norm.(map(-, targetConv.weight, filt.weight)) .^ 2) / sum(norm.(targetConv.weight) .^ 2) # the relative error
0.8206548516626784
0.8207499248183181

```

Expand All @@ -140,10 +144,13 @@ using FourierFilterFlux, Flux, LinearAlgebra # hide
fitThis = zeros(64,352,3); fitThis[1:3,(176-3:176+3),1] .= 1; # hide
fitThis[1:15,(176-15:176+15),2] .= 1; fitThis[1:32,(176-44:176+44),3] .= 1; # hide
targetConv = ConvFFT(fitThis, nothing, (127,352,1,10)) # hide
loss(x,y) = norm(filt(x) - targetConv(x)) # hide
genEx(n) = [(cpu(randn(ex2Dsize)), true) for i=1:n]; # hide
Flux.train!(loss, Flux.params(filt), genEx(100), ADAM()) # hide
loss(randn(ex2Dsize), nothing) # hide
loss(m, x) = norm(m(x) - targetConv(x)) # hide
genEx(n) = [cpu(randn(ex2Dsize)) for i=1:n]; # hide
opt = Flux.setup(Adam(), filt); # hide
for x in genEx(100) # hide
Flux.train!(loss, filt, [(x,)], opt) # hide
end # hide
loss(filt, randn(ex2Dsize)) # hide
plot(heatmap(filt,vis=1), heatmap(filt,vis=2), heatmap(filt,vis=3),
heatmap(targetConv,vis=1), heatmap(targetConv,vis=2),
heatmap(targetConv,vis=3))
Expand Down
5 changes: 5 additions & 0 deletions src/FourierFilterFlux.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ using AbstractFFTs, FFTW # TODO: check the license on FFTW and such
using ContinuousWavelets
using RecipesBase
using CUDA
using Functors

Functors.@leaf FFTW.rFFTWPlan
Functors.@leaf FFTW.cFFTWPlan
Functors.@leaf FFTW.Plan

const use_cuda = Ref(false)
if CUDA.functional()
Expand Down
4 changes: 2 additions & 2 deletions src/paramCollection.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Flux.@layer ConvFFT

function Flux.trainable(CFT::ConvFFT{A,B,C,D,E,F,G,true}) where {A,B,C,D,E,F,G}
(CFT.weight, CFT.bias)
(; weight = CFT.weight, bias = CFT.bias)
end
function Flux.trainable(::ConvFFT{A,B,C,D,E,F,G,false}) where {A,B,C,D,E,F,G}
tuple()
NamedTuple()
end