-
Notifications
You must be signed in to change notification settings - Fork 5
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
Added save compatible version of filenames
, arrays
and images
function
#30
Conversation
Codecov Report
@@ Coverage Diff @@
## master #30 +/- ##
==========================================
- Coverage 91.73% 91.66% -0.07%
==========================================
Files 4 4
Lines 121 168 +47
==========================================
+ Hits 111 154 +43
- Misses 10 14 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My ideal interface would have three versions of this, images
, arrays
, filenames
, to match the three functions we currently have that support iteration. This gives a consistent interface across the API- I can go from
for img in images(coll)
# ...
end
to this:
images(coll) do img
# ...
end
and get the same functionality, plus the saving if I want it.
filenames
, arrays
and images
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, skimming over the three versions, I think we should have a little more granularity in the functionality, like I mention with splitting the make_file
function.
In addition, the current mechanics are kind of hard to understand- if path
is not nothing we will save files. Where will you save files? Is this path supposed to be the load path, too? What is being saved? Can I do a dry-run without actually saving?
Some of these just require some documentation, but I really think we need to re-evaluate the functionality of the path
argument in its current state and either change the name, add more documentation, or split its functionality into two parts (eg path
is just the save path, which defaults to same folder as the file and the save mechanics can be manually enabled/disabled with save
).
I left some comments about using map
style instead of the for-loop, in addition I want you to think about how we can use the functions that already exist to greatly simplify our API. Consider what the current images
function can do- iterate over the dataframe with some options and provide each ImageHDU
. What are you doing here? You're iterating over the dataframe with some options, providing the ImageHDU
, applying a user-provided function, then adding some more new options. This sounds like you could probably write this function to simply take
function images(f, df; options_related_to-saving..., kwargs...)
processed_images = map(images(df; kwargs...)) do img
# do your thing
return processed_img
end
return processed_images
end
Hopefully that makes sense! This will be invaluable if you ever add an extra keyword argument to the looping-only functions and don't want to have to rewrite all of these as well! The basic idea is that all these functions do is the same iteration but with some fun file-saving mechanics. Everything else should work the same.
src/collection.jl
Outdated
If `path = nothing`, then save functionality does not execute. It returns an array of arrays which contains final returned values of function. | ||
A suffix and prefix can be added to filename of newly created files by modifying `save_suffix` and `save_prefix`, `save_delim` is used as delimiter. | ||
`ext` is the extension of files to be taken into consideration for applying function, by default it is set to `r"fits(\\.tar\\.gz)?"i`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will definitely want to show some examples with this, I'm not sure whether it makes more sense to copy-paste three nearly identical examples in the docstrings or whether to relagate that to the online documentation. Perhaps both?
Another way to get around this is to put all of the filename-changing stuff into the docstring for make_file
and then show the CCDReduction.make_file
docstring in the docs and reference it. This removes the repitition and keeps all the relevant info in docstrings, but at the cost of having to search around a little more to get the information you need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some docs comments- should propagate to all three versions
src/collection.jl
Outdated
Iterative version of `arrays`, returns data loaded by `FITSIO` using `CCDReduction.getdata` into an `Array`. | ||
It utilizes the `path` and `hdu` from the `collection`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iterative version of `arrays`, returns data loaded by `FITSIO` using `CCDReduction.getdata` into an `Array`. | |
It utilizes the `path` and `hdu` from the `collection`. | |
Iterates over `collection` using each `path` and `hdu` to load data using [`CCDReduction.getdata`](@ref) into an `Array`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have used:
[`CCDReduction.getdata`](@ref)
[`CCDReduction.write_fits`](@ref)
This fails the building of docs, some warning that shows up:
┌ Warning: no doc found for reference '[`CCDReduction.write_fits`](@ref)' in src/api.md.
└ @ Documenter.CrossReferences ~/.julia/packages/Documenter/PLD7m/src/CrossReferences.jl:160
┌ Warning: no doc found for reference '[`CCDReduction.write_fits`](@ref)' in src/api.md.
└ @ Documenter.CrossReferences ~/.julia/packages/Documenter/PLD7m/src/CrossReferences.jl:160
┌ Warning: no doc found for reference '[`CCDReduction.write_fits`](@ref)' in src/api.md.
└ @ Documenter.CrossReferences ~/.julia/packages/Documenter/PLD7m/src/CrossReferences.jl:160
If I don't cross-reference the documentation, the doc gets build completely. Is it a bug with Documentation.jl
?
One of the most important functions of this package!
Related issue: #28