You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2020. It is now read-only.
Why are min_cut and max_cut needed as inputs since it is what is returned? There are mentions of scaling the image, but the image should remain unchanged, correct?
Also, for returns, it should not say out but instead the outputs should be min_cut and max_cut. All functions that return multiple arguments return a tuple, so I don't think that needs to be specified.
I realize now that it's because there is a template docstring (but I think it should still be fixed).
As a side note, is there really a need to have one function per scaling? Couldn't this be done by a single function, preventing the need to have the docstring being copied? In APLpy we have a normalize class that matplotlib uses:
Of course this is matplotlib-specific so I'm not suggesting doing that, but it shows you don't need that many arguments if you have a single point of entry. We also have pmin and pmax defined elsewhere that the user can use to define the percentile. Anyway I'd be happy at some point to try and work on refactoring this if there was interest (and I'm hoping APLpy can then just simply use imageutils for the scaling).
Thanks, @astrofrog. Yes, as I mentioned in #11 (comment), I'm going to combine them in one function with a keyword option specifying the type of scaling. That looks similar to what you did in APLpy. Is the name stretch preferable to scaling?
I don't recall why I left min/max_cut as optional inputs (it may have been to have one single function parse all the "cutlevel" inputs and return the cut levels without having to repeat parsing the inputs). It's not really needed since min/max_cut could be parsed out in rescale_img and then send only the "percentage" keywords on to find_imgcuts. That would be less confusing.
There are mentions of scaling the image, but the image should remain unchanged, correct?
I'm not sure what you mean by this. find_imgcuts doesn't scale anything. rescale_img (and the scale_* functions) rescales the image between 0 and 1 (using the min/max cuts). The image will be unchanged only if its min/max was 0 and 1 and linear scaling is used.
@larrybradley - regarding my comment on scaling, the issue is that e.g. percentile says 'The percentage of the image values to scale.' in find_imgcuts, but of course, find_imgcuts doesn't scale anything.
Activity
astrofrog commentedon Aug 6, 2014
Also, for returns, it should not say
outbut instead the outputs should bemin_cutandmax_cut. All functions that return multiple arguments return a tuple, so I don't think that needs to be specified.astrofrog commentedon Aug 6, 2014
I realize now that it's because there is a template docstring (but I think it should still be fixed).
As a side note, is there really a need to have one function per scaling? Couldn't this be done by a single function, preventing the need to have the docstring being copied? In APLpy we have a normalize class that matplotlib uses:
https://github.com/astrofrog/aplpy/blob/master/aplpy/normalize.py
Of course this is matplotlib-specific so I'm not suggesting doing that, but it shows you don't need that many arguments if you have a single point of entry. We also have
pminandpmaxdefined elsewhere that the user can use to define the percentile. Anyway I'd be happy at some point to try and work on refactoring this if there was interest (and I'm hoping APLpy can then just simply use imageutils for the scaling).larrybradley commentedon Aug 6, 2014
Thanks, @astrofrog. Yes, as I mentioned in #11 (comment), I'm going to combine them in one function with a keyword option specifying the type of scaling. That looks similar to what you did in APLpy. Is the name
stretchpreferable toscaling?I don't recall why I left
min/max_cutas optional inputs (it may have been to have one single function parse all the "cutlevel" inputs and return the cut levels without having to repeat parsing the inputs). It's not really needed sincemin/max_cutcould be parsed out inrescale_imgand then send only the "percentage" keywords on tofind_imgcuts. That would be less confusing.I'm not sure what you mean by this.
find_imgcutsdoesn't scale anything.rescale_img(and thescale_*functions) rescales the image between 0 and 1 (using the min/max cuts). The image will be unchanged only if its min/max was 0 and 1 and linear scaling is used.astrofrog commentedon Aug 6, 2014
@larrybradley - regarding my comment on scaling, the issue is that e.g.
percentilesays 'The percentage of the image values to scale.' infind_imgcuts, but of course,find_imgcutsdoesn't scale anything.larrybradley commentedon Aug 6, 2014
Ah. Yes, that's because of using the template docstring (now I know what you meant by that). I will fix that in the new version. Thanks.
larrybradley commentedon Sep 16, 2014
This was addressed in #17, so I'm closing.