Git Product home page Git Product logo

Comments (7)

mcara avatar mcara commented on August 25, 2024

Git blame (if it helps understand the context):

0f3e78c

from stwcs.

mcara avatar mcara commented on August 25, 2024

I think this code was intended to pick a wcsname for the WCS to be archived based on the last archived WCS when user did not provide wcsname or when the primary WCS does not have a name.

I'll make a PR to fix the code which also has another bug at

wname = wnames

wnames is a dictionary while wname should be a string.

from stwcs.

nden avatar nden commented on August 25, 2024

@mcara I doubt that was the intention because ... why? Perhaps it was only meant to create a default name.

from stwcs.

mcara avatar mcara commented on August 25, 2024

Hm, if only creating a default name, why even use a loop with IF?

from stwcs.

mcara avatar mcara commented on August 25, 2024

@stsci-hack Could you please take a look at this?

from stwcs.

stsci-hack avatar stsci-hack commented on August 25, 2024

Best guess: a clumsy attempt to loop over the WCSNAMES in reverse order with the intended syntax most likely supposed to be 'a[::-1]'. It mostly worked since it pulled and checked the last key which was most often the desired default WCS since it was the last one archived. So, feel free to revise or remove as needed.

from stwcs.

mcara avatar mcara commented on August 25, 2024

I believe https://github.com/spacetelescope/stwcs/pull/134/files#diff-516dcd10bb4c104d97362626d506e981R127 does exactly that:

wname = sorted(wnames.items(), key=lambda x: x[0])[-1][1]

Sort dictionary items by keys and pick the value of the last item (key).

from stwcs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.