Wavelets.jl icon indicating copy to clipboard operation
Wavelets.jl copied to clipboard

Only code reorganization (src/ directory)

Open thimotedupuch opened this issue 4 months ago • 6 comments

@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.

thimotedupuch avatar Aug 14 '25 18:08 thimotedupuch

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.

gummif avatar Aug 15 '25 17:08 gummif

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 ?

thimotedupuch avatar Aug 15 '25 20:08 thimotedupuch

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.

wheeheee avatar Aug 16 '25 15:08 wheeheee

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...

thimotedupuch avatar Aug 17 '25 09:08 thimotedupuch

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

wheeheee avatar Aug 17 '25 11:08 wheeheee

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

thimotedupuch avatar Aug 17 '25 13:08 thimotedupuch