Skip to content

Recreating some IRAF functionality? #370

Closed

Description

@AlexaVillaume

Hi there,

I have some code that relies on IRAF (e.g. median, imcombine, blkrep, ...). I'm planning on rewriting it to be pure python. I looked through astropy and the affiliated packages to see if python versions of the IRAF commands already existed and didn't find anything. Since this package seemed to be the place where IRAF functions would most likely be recreated I thought I'd double check here.

If indeed these functions don't exist, would it be something to include in the ccdproc package? For example, I was thinking of writing a wrapper for the scipy.signal.medfilt to have it work more like the IRAF task median (I did see that there is a cosmicray_median function in this package, maybe some functionality could be reused?).

I'm not very familiar with IRAF (which is why I want to change the code to use python instead) so I'm not sure if the reason these functions don't exist in astropy/the affiliated packages is because people don't like them for some reason. Please let me know if that's the case.

Thanks,
Alexa

Activity

  1. crawfordsm commented on Jul 7, 2016

    @crawfordsm
    Member

    It would be great for you to contribute whatever you have and would be wonderful to include it. The reason some of the functionality may not exist is typically because we have not had time to implement it and so if there is stuff you would like to see in ccdproc, please let us know. So it's not at all that we do not like them, but either we haven't needed them or just have not implemented them yet. So having your help and contributes would be a big help.

    My suggestion for how best to proceed is to open an issue for each feature that you would like to see but can't find in ccdproc. Somethings do exists in other forms and just are currently not wrapped in ccdproc and so those might be quite easy to include (like the median example you give--it would be great to include that as a function in ccdproc). We also might be able to suggest some other places that things do show up or where there is overlap or the best way to proceed (which in some cases might be implementing the code and in others it might be better or more visible documentation).

    Nonetheless, it would be great to have your contributions and thank you for your interest!

  2. added this to the 1.2 milestone on Sep 6, 2016
  3. pllim commented on Sep 8, 2016

    @pllim
    Member

    For imcombine, STScI has some kind of Python implementation already. See https://github.com/spacetelescope/stsci.image/blob/master/stsci/image/numcombine.py . We do plan to consolidate such implementations currently scattered across the board somewhere easier to find. c/c @saraogaz, @justincely

    I was pretty sure we also re-implemented blkrep in Python before but I can't find it now... @larrybradley , was it absorbed into stats or photutils?

  4. pllim commented on Sep 8, 2016

    @pllim
    Member

    EDIT: Okay, we didn't re-implement blkrep but rather blkavg. Not sure if that one made it into official STScI distribution, but I have a copy at https://github.com/pllim/playpen/blob/master/blkavg_rewrite.py (still need some work to optimize it but I think it works)

  5. MSeifert04 commented on Sep 8, 2016

    @MSeifert04
    Contributor

    @pllim blkrep could be astropy.nddata.utils.block_replicate and astropy.nddata.utils.block_reduce or ccdproc.rebin (this might be subject to change because it doesn't do what people expect #388).

  6. larrybradley commented on Sep 8, 2016

    @larrybradley
    Member

    @pllim Yes, I added block_replicate and block_reduce to astropy. block_reduce is flexible in that it can apply any user-input function to the data. The default is func=np.sum, which is equivalent to blkrep block summing. The equivalent of blkavg would be to input func=np.mean (or e.g. np.ma.mean).

  7. larrybradley commented on Sep 8, 2016

    @larrybradley
    Member

    Sorry, blk_rep is block_replicate not block_reduce.....

  8. MSeifert04 commented on Sep 8, 2016

    @MSeifert04
    Contributor

    Also imcombine is probably already implemented in ccdproc: low-level interface Combiner and high-level combine

  9. SaOgaz commented on Oct 19, 2016

    @SaOgaz

    Hi @AlexaVillaume,
    This is super related to a project we're working on right now at STScI to replace needed IRAF tasks and functionality. Can I ask what part of the IRAF functionality you want that's not part of scipy.signal.medfilt ? This could easily be something that goes on our to-do list...

  10. AlexaVillaume commented on Oct 20, 2016

    @AlexaVillaume
    Author

    Hi @SaraOgaz,

    My thought was to make a wrapper to the scipy functionality so that one could just pass a name of a fits file, like in IRAF. Then also to work properly over MEFs, which I don't think the IRAF version does. Is this the same project that @pllim brought up?

  11. pllim commented on Oct 20, 2016

    @pllim
    Member

    @AlexaVillaume , yes, the very same project.

  12. modified the milestones: 1.2, 1.3 on Dec 13, 2016
  13. modified the milestone: 1.3 on Jul 18, 2017
  14. added this to the milestone on Jul 18, 2017
  15. modified the milestone: on Jul 18, 2017
  16. modified the milestones: , on Apr 5, 2018
  17. crawfordsm commented on Dec 7, 2018

    @crawfordsm
    Member

    What might also be of help is the following project:
    https://stak-notebooks.readthedocs.io/en/latest/

    We are going to close this issue for right now, but please open individual issues if there is a specific functionality to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions