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

Add docstrings for exported functions and types #59

Merged
merged 4 commits into from
Mar 24, 2022

Conversation

clin045
Copy link
Contributor

@clin045 clin045 commented Jan 17, 2022

Added docstrings for the exported functions and types. This should make the package a bit more friendly to use, since currently the only way to access much of the documentation is by looking at the source comments.

@clin045
Copy link
Contributor Author

clin045 commented Feb 3, 2022

Is this project still active?

@korbinian90
Copy link
Contributor

I like these docstrings, can someone help with this?
@Tokazama
@timholy

Copy link
Member

@timholy timholy left a comment

Choose a reason for hiding this comment

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

Sorry no one gave you a review here. I'm quite peripheral to this package but it's very occasionally useful to me.

src/NIfTI.jl Outdated
"""
NIVolume{T<:Number,N,R} <: AbstractArray{T,N}
An `N`-dimensional NIfTI volume, with raw data of type
`R`. Note that if `raw <: Number`, it will be converted to `Float32`. Additionally, the header is automatically
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
`R`. Note that if `raw <: Number`, it will be converted to `Float32`. Additionally, the header is automatically
`R`. Note that if `R <: Number`, it will be converted to `Float32`. Additionally, the header is automatically

Also there is no antecedant for "it"---presumably you're referring to T but that hasn't been described. It's also confusing: if the user creates the type with a specific T that T must be used exactly as specified. I think you're conflating the type documentation with the constructor, which in the absence of a manually-specified T does indeed use promotion to compute a type compatible with floating-point arithmetic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I was referring to the behavior of the constructor on line 131. Is it preferable to document constructor behavior in a separate docstring?

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be great to document the constructor too. But you can bundle it with the type into a single docstring, just cleanly specify whether you're talking about the type or the constructor.

Sometimes I just document the constructor and leave the type as an undocumented internal detail.

src/NIfTI.jl Outdated Show resolved Hide resolved
src/NIfTI.jl Outdated Show resolved Hide resolved
@clin045
Copy link
Contributor Author

clin045 commented Mar 22, 2022

@timholy Thanks for the review! Julia is such a great language for neuroimaging work, and I'd love to help grow the ecosystem.

@Tokazama
Copy link
Member

Tokazama commented Mar 23, 2022

How often are people actively mutating fields in the header? I'd prefer that users not muck around with the header unless they really know what is going on and I'd like to just remove this type and attach an immutable header to Metadata.MetaArray.

@Tokazama Tokazama merged commit 76c84c8 into JuliaNeuroscience:master Mar 24, 2022
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.

4 participants