Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Commit af04bf9

Browse files
committed
refactor data
1 parent 3d8f717 commit af04bf9

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/NeuralOperators.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module NeuralOperators
22
using DataDeps
33
using Fetch
44
using MAT
5-
5+
66
using Flux
77
using FFTW
88
using Tullio
@@ -12,6 +12,6 @@ module NeuralOperators
1212
register_datasets()
1313
end
1414

15-
include("preprocess.jl")
15+
include("data.jl")
1616
include("fourier.jl")
1717
end

src/preprocess.jl renamed to src/data.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export
2-
get_data
2+
get_burgers_data
33

44
function register_datasets()
55
register(DataDep(
@@ -15,7 +15,7 @@ function register_datasets()
1515
))
1616
end
1717

18-
function get_data(; n=1000, Δsamples=2^3, grid_size=div(2^13, Δsamples))
18+
function get_burgers_data(; n=1000, Δsamples=2^3, grid_size=div(2^13, Δsamples))
1919
file = matopen(joinpath(datadep"BurgersR10", "burgers_data_R10.mat"))
2020
x_data = collect(read(file, "a")[1:n, 1:Δsamples:end]')
2121
y_data = collect(read(file, "u")[1:n, 1:Δsamples:end]')

test/preprocess.jl renamed to test/data.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@testset "get data" begin
2-
xs, ys = get_data()
1+
@testset "get burgers data" begin
2+
xs, ys = get_burgers_data()
33

44
@test size(xs) == (2, 1024, 1000)
55
@test size(ys) == (1024, 1000)

test/fourier.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
SpectralConv1d(ch, modes)
88
)
99

10-
𝐱, _ = get_data()
10+
𝐱, _ = get_burgers_data()
1111
@test size(m(𝐱)) == (64, 1024, 1000)
1212

1313
T = Float32
@@ -25,7 +25,7 @@ end
2525
FourierOperator(ch, modes)
2626
)
2727

28-
𝐱, _ = get_data()
28+
𝐱, _ = get_burgers_data()
2929
@test size(m(𝐱)) == (64, 1024, 1000)
3030

3131
loss(x, y) = Flux.mse(m(x), y)
@@ -34,7 +34,7 @@ end
3434
end
3535

3636
@testset "FNO" begin
37-
𝐱, 𝐲 = get_data()
37+
𝐱, 𝐲 = get_burgers_data()
3838
𝐱, 𝐲 = Float32.(𝐱), Float32.(𝐲)
3939
@test size(FNO()(𝐱)) == size(𝐲)
4040

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ using Test
33
using Flux
44

55
@testset "NeuralOperators.jl" begin
6-
include("preprocess.jl")
6+
include("data.jl")
77
include("fourier.jl")
88
end

0 commit comments

Comments
 (0)