johnnygreco / astrostamps

An astronomy stamp factory
MIT License
0 stars 0 forks source link

Common API #1

Open johnnygreco opened 7 years ago

johnnygreco commented 7 years ago

I added the tools we already have. I slightly modified HSCSession to optionally take a base url, which one can use if they have access to non-public data.

I'm thinking we should make a single class (StampFactory?) that can fetch images from any of the surveys. We could keep the individual helper functions in tools, since it may be easier to call them sometimes, but it'd be nice to have a class that unifies them all into a common API... what do you think?

smoh commented 7 years ago

yes, sounds good. Could you also add the things you had for GALEX just so that we can get more sense of common operations?

johnnygreco commented 7 years ago

Just added the GALEX utility. It's a bit clunky, so let know if you can think of a better way to do it. It's based on a script, which is mentioned in the doc string.

smoh commented 7 years ago

Hm.. I don't think I have a better idea, and if you go ahead and code the class you had in mind, I'd be happy to provide feedback.

I misread your intent, and thought you wanted something like abstract base class, which you can check out in abc branch (not complete).

smoh commented 7 years ago

It just occurred to me that maybe unifying interface this way isn't such a bad idea for what you wanted to do (lookup all surveys), and added sketch for that in abc branch.

The idea for writing abstract base class is for all surveys we fetch data and process it (common operation), but force the same api fetch(ra, dec, size, **kwargs), and process a) input url params, b) conversion from returned data to image (2d array(s)) specifically for each survey. Feel free to dump it though. I think you'll have a better sense of what's useful. Also, forcing the same call signature doesn't require an ABC, technically. (You can just write it that way with functions for each survey too.)

johnnygreco commented 7 years ago

Actually, this is exactly what I was thinking. If you think this sounds good, let's run with it!