Skip to content
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

Docstrings Review #297

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Docstrings Review #297

wants to merge 10 commits into from

Conversation

beorostica
Copy link
Contributor

This pull request is meant to address issue #260.

Comment on lines +185 to +186
- `axis`: (`::String`, `="axial"`, opts=[`"axial"`, `"coronal"`, `"sagittal"`]) orientation
of the phantom
Copy link
Member

Choose a reason for hiding this comment

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

Why the extra line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was simply trying to adhere to the 92-character line length limit.

@@ -83,7 +83,7 @@ Sequence() = Sequence([Grad(0, 0)])
"""
str = show(io::IO, s::Sequence)
Copy link
Member

@cncastillo cncastillo Jan 18, 2024

Choose a reason for hiding this comment

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

This function does not return a string. The same for ALL show functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addresed in b1f8e54

Comment on lines 172 to 174
y = is_RF_on(x::Sequence)
y = is_RF_on(x::Sequence, t::Vector{Float64})
y = is_RF_on(x::Sequence, t::Vector{Real})

Copy link
Member

@cncastillo cncastillo Jan 18, 2024

Choose a reason for hiding this comment

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

Rename x to seq everywhere in the docstrings (if x is a Sequence).

Rename x to rf everywhere in the docstrings (if x is an RF).

Rename x to gr everywhere in the docstrings (if x is a Grad).

Rename x to adc everywhere in the docstrings (if x is an ADC).

Rename x to delay everywhere in the docstrings (if x is a Delay).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 949850c

docs/src/api.md Outdated Show resolved Hide resolved
Copy link
Member

@cncastillo cncastillo Jan 18, 2024

Choose a reason for hiding this comment

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

General comment (major revision).

Please make sure that the documentation is not more complex that the function; if the function is: f(x)=x^2, it does not need a docstring:

    y = f(x)

A function that calculates the square of a number.

# Arguments
- `x`: (`::Number`) input number

# Output
- `y`: (`::Number`) output number

# Example
...

This is true for the show functions and others, go one-by-one and ask the question "Is this docstring unnecessarily complex for the function?". I would argue that the only functions that need more in-depth documentation are the exported functions. If there is more docstring that code, we have a problem; do not bloat the code.

Copy link
Contributor Author

@beorostica beorostica Jan 23, 2024

Choose a reason for hiding this comment

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

I agree that should be docstring when it is not necessary.

I did the excercise you proposed, however I couldn't find more autodescriptive functions which wouldn't require a docstring, according to my criteria.

For example, this one:

    Rx = rotx(θ::Real)

Rotates a three-dimensional vector or matrix with three rows counter-clockwise with respect
to the x-axis.

# Arguments
- `θ`: (`::Real`, `[rad]`) rotation angle

# Returns
- `Rx`: (`::Matrix{Real}`) rotation matrix

This function looks like is simple enough to don't require a docstring, however the units are important and the direction of the rotation too.

Maybe, I'm a little bit biased since I also try to keep uniformity in the docsstrings.

I eliminated the docstrings for Base.show methods in b1f8e54

@cncastillo
Copy link
Member

Also this branch is not passing for Julia 1.9

beorostica and others added 2 commits January 19, 2024 09:22
Co-authored-by: Carlos Castillo Passi <cncastillo@uc.cl>
Copy link

codecov bot commented Jan 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e3107c1) 92.60% compared to head (949850c) 92.60%.
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #297      +/-   ##
==========================================
- Coverage   92.60%   92.60%   -0.01%     
==========================================
  Files          33       33              
  Lines        2245     2244       -1     
==========================================
- Hits         2079     2078       -1     
  Misses        166      166              
Flag Coverage Δ
base 92.66% <100.00%> (-0.01%) ⬇️
core 90.47% <100.00%> (ø)
files 92.34% <ø> (ø)
komamri 93.89% <ø> (ø)
plots 93.28% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
KomaMRIBase/src/datatypes/Phantom.jl 95.50% <100.00%> (ø)
KomaMRIBase/src/datatypes/Sequence.jl 91.88% <100.00%> (-0.03%) ⬇️
KomaMRIBase/src/datatypes/sequence/ADC.jl 94.87% <ø> (ø)
KomaMRIBase/src/datatypes/sequence/Delay.jl 100.00% <100.00%> (ø)
KomaMRIBase/src/datatypes/sequence/Grad.jl 91.37% <ø> (ø)
KomaMRIBase/src/datatypes/sequence/RF.jl 87.03% <ø> (ø)
...IBase/src/datatypes/simulation/DiscreteSequence.jl 100.00% <ø> (ø)
KomaMRIBase/src/sequences/PulseDesigner.jl 94.05% <ø> (ø)
KomaMRIBase/src/timing/KeyValuesCalculation.jl 84.72% <ø> (ø)
KomaMRIBase/src/timing/TimeStepCalculation.jl 100.00% <ø> (ø)
... and 12 more

@cncastillo cncastillo linked an issue Jan 19, 2024 that may be closed by this pull request
92 tasks
@beorostica
Copy link
Contributor Author

Also this branch is not passing for Julia 1.9

Now it is passing Julia 1.9 and 1.10 (but fails on Nightly)

@cncastillo cncastillo removed a link to an issue Jun 16, 2024
92 tasks
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.

2 participants