Skip to content

Conversation

thimotedupuch
Copy link

@wheeheee This is the V2 of last PR.

This time I only reorganized the code inside the src/ directory, I did not change any code logic.

The code was previously using the mod subdirectory, that has been deleted and now follows the structure :

src/
	Wavelets.jl # Export the modules for the user and for the sourcecode
	Util/
		Util.jl  # export Util module
		util.jl
		dyadic.jl
		non_dyadic.jl

	Threshold/
		Threshold.jl # export Threshold module
		threshold.jl
		denoising.jl
		basis_functions.jl
		entropy.jl

	Transforms/
		Transforms.jl # export Transforms module
		transforms.jl
		transforms_filter.jl
		transforms_lifting.jl
		transforms_maximal_overlap.jl

	WT/
		WT.jl # export WL module
		wt.jl

	Plot/
		Plot.jl # export Plot module
		plot.jl
	

The reexport dependency is not needed anymore (I believe ?). Also the functions from the different submodules are all exported, as well as the submodules themselves (except for Util).

Here's an overview of the diff :

 ➜ jj diff --from master --to code_refactor --stat
src/Plot/Plot.jl                                      |   8 +
src/{mod/Plot.jl => Plot/plot.jl}                     |  55 +++---
src/Threshold/Threshold.jl                            |  27 +++
src/Threshold/basis_functions.jl                      |  56 ++++++
src/Threshold/denoising.jl                            | 122 ++++++++++++++
src/Threshold/entropy.jl                              | 129 ++++++++++++++
src/Threshold/threshold.jl                            | 129 ++++++++++++++
src/Transforms/Transforms.jl                          |  10 +
src/Transforms/transforms.jl                          | 226 ++++++++++++++++++++++++++
src/{mod => Transforms}/transforms_filter.jl          | 258 ++++++++++++++---------------
src/{mod => Transforms}/transforms_lifting.jl         | 208 +++++++++++-------------
src/{mod => Transforms}/transforms_maximal_overlap.jl |  12 +-
src/Util/Util.jl                                      |  44 +++++
src/Util/dyadic.jl                                    |  20 ++
src/Util/non_dyadic.jl                                |  27 +++
src/{mod/Util.jl => Util/util.jl}                     | 286 ++++++++++++---------------------
src/WT/WT.jl                                          |  13 +
src/WT/wt.jl                                          | 454 ++++++++++++++++++++++++++++++++++++++++++++++++++++
src/Wavelets.jl                                       |  75 ++++++--
src/mod/Threshold.jl                                  | 462 -----------------------------------------------------
src/mod/Transforms.jl                                 | 239 ---------------------------
src/mod/WT.jl                                         | 493 ---------------------------------------------------------
22 files changed, 1693 insertions(+), 1660 deletions(-)

 ➜ jj diff --from master --to code_refactor --summary
A src/Plot/Plot.jl
R src/{mod/Plot.jl => Plot/plot.jl}
A src/Threshold/Threshold.jl
A src/Threshold/basis_functions.jl
A src/Threshold/denoising.jl
A src/Threshold/entropy.jl
A src/Threshold/threshold.jl
A src/Transforms/Transforms.jl
A src/Transforms/transforms.jl
R src/{mod => Transforms}/transforms_filter.jl
R src/{mod => Transforms}/transforms_lifting.jl
R src/{mod => Transforms}/transforms_maximal_overlap.jl
A src/Util/Util.jl
A src/Util/dyadic.jl
A src/Util/non_dyadic.jl
R src/{mod/Util.jl => Util/util.jl}
A src/WT/WT.jl
A src/WT/wt.jl
M src/Wavelets.jl
D src/mod/Threshold.jl
D src/mod/Transforms.jl
D src/mod/WT.jl

If this gets merged I will be able to start actually working on the code.

@wheeheee for the logo we'll see later.

@gummif
Copy link
Member

gummif commented Aug 15, 2025

Thanks for taking time to clean up.

One thing I'm not sure is ok is having files with same name modulo case (e.g. wt.jl and WT.jl) on windows.

@thimotedupuch
Copy link
Author

One thing I'm not sure is ok is having files with same name modulo case (e.g. wt.jl and WT.jl) on windows.

Okay, then what would be the ideal file structure ?

@wheeheee
Copy link
Member

You could just rename the lowercase files to *_core.jl, *_main.jl, or even just _*.jl. That solves the problem with case-insensitivity on Windows.

@thimotedupuch
Copy link
Author

Nice, thank you for fixing the tests!
It would be cool if the Julia programming language official docs could provide information about the recommended way of doing all of this : structuring the files, where to put the using statements, how to handle the namespace...

@wheeheee
Copy link
Member

A lot of these are personal preferences, some communities like SciML have style guides, and there are recommendations on Julia's discourse if you search for them

Copy link
Member

@wheeheee wheeheee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not all comments are related to the reorganisation, but overall LGTM?

name(::$TYPE{N1,N2}) where {N1,N2} = string($NAMEBASE, N1, "/", N2)
vanishingmoments(::$TYPE{N1,N2}) where {N1,N2} = (N1, N2)
end
for i in length(RANGE1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird, probably 1:length(RANGE1)? but it somehow works because it's one element long, and 1[1] is ok in julia...

Comment on lines +115 to +122
function nspin2circ(nspin::Tuple, i::Int)
c1 = CartesianIndices(nspin)[i].I
c = Vector{Int}(undef, length(c1))
for k in 1:length(c1)
c[k] = c1[k] - 1
end
return c
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this just collect(c1 .- 1)

Comment on lines +171 to +173
function ($Xwt!)(y::WPTArray{T}, scheme::GLS, L::Integer) where {T<:ValueType}
return ($Xwt!)(y, scheme, maketree(length(x), L, :full))
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x looks like it is undefined in the function?

nx = nout<<1
out::AbstractVector{<:Number}, iout::Integer, nout::Integer,
x::AbstractVector{<:Number}, ix::Integer,
shift::Integer=0, ss::Bool=false) where {T<:Number}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may be the autoformatter's work on copy and paste, but I think it's fine without curlies. also, a bit noisy.

Copy link
Member

@wheeheee wheeheee Aug 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like jujutsu is not so good at tracking renamed files? (Transforms.jl also.) git mv would have cut down the diffs

Comment on lines +1 to +2
using ..Util

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using ..Util

using Util while in Util seems redundant, although it doesn't error.

@@ -0,0 +1,454 @@
using ..WT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using ..WT

this too

@thimotedupuch
Copy link
Author

Yeah, thanks for the review
as I mentioned I did not change any code but there are a lot of possible improvements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants