-
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
Dynamic generation of k_funcs from application XMLs #1
Comments
Maybe I'm misunderstanding what you're saying, but I think you're saying two things:
I don't know that (1) is even needed (but I'm probably not understanding). Under the current paradigm, if you do import kalasiris as isis
hi2isis(from_='some.img', to='some.cub') You aren't specifying the other two arguments ( If you only say For (2), I think you're saying that a call like either of these: getkey_k(f, o, g, k1, k2)
getkey_k(f, o, g, k2, keyword=k1) Should be equivalent to: getkey(from_=f, objname=o, grpname=g, keyword=k1, keyindex=k2) Basically assigning any keyword arguments to the right keyword, and then taking any positional arguments and assigning them, in order, to the keywords specified in the XML file that aren't already 'taken.' That's sounds like a good idea to me, and could probably just be incorporated into the main kalasiris argument parsing logic without much fuss (although you'd have to engage some minimal-match to parameter names logic in Python rather than just letting ISIS handle it). My intent with the _k functions was to provide an interface that is more natural, or provides more 'features' than the default Factory implementation. For For The idea is that the _k functions provide more features, or program-specific features for how users might expect to use them than are available normally. I just made a few initial ones, to explore the space, and see if any patterns emerged (the default TO behavior in |
I had originally thought about implementing the second option, but it's got one issue. The "required" parameters for applications are intermingled with the "optional" parameters in the xml files. If the "required" arguments are positional arguments and the 'optional" arguments are kwargs it would make for an cleaner signatures. Here's what I envision for spiceinit
Then, you could optionally tack some kwargs onto it for the shapemodel
If we just convert all of the application arguments into positional arguments, then you would have to enter every argument. So, your spiceinit signature would be |
As far as I know, the two code snippets above should already work with kalasiris! :MindBlown: So on the command line you can say:
and kalasiris supports the pysis calling style (assuming your import and variable inputs as above): spiceinit(from_=my_cube, shape='user', model='my_dem') But, like you, I felt that since almost all ISIS programs require a spiceinit(my_cube, shape='user', model='my_dem')
spiceinit(my_cube) If kalasiris gets one positional argument, it assumes it is a The call to Of course, this also means that you can do this: spiceinit(my_cube, jesse='Awesome!') which
If you tried to do that in your Python, calling the above function would throw a And, of course, just for yuks, kalasiris also supports ISIS's 'reserved parameters' on any program, by using two underbars (
and you can do that with kalasiris like this: spiceinit(my_cube, restore__='some.par') There are two underbars after I thought you were saying that you wanted the ability to have more than one regular positional argument (because, of course, you can already say Any of that is possible, but would require more logic in the Factory-built function to read the XML, etc. It would be fun, but I'm tempted to defer it (and keep the code small in |
Maybe this has less use that I thought if it only applies to 2+ argument calls. Something like k_funcs for all of the _2isis apps would be nice, but is another topic. |
There are only a handful of apps supported via the k_funcs interface. It should be possible to generate the k_funcs programmatically similar to how the regular functions are generated.
All of the parameters are defined under
<groups>
,<group>
,<parameter>
. Any parameter with a<default>
,<item>
or<internalDefault>
can be set as a kwarg. All of the other arguments can be positional arguments.The text was updated successfully, but these errors were encountered: