-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
MAST: Moving target TESScut #2121
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2121 +/- ##
==========================================
+ Coverage 62.70% 62.72% +0.02%
==========================================
Files 131 131
Lines 16828 16855 +27
==========================================
+ Hits 10552 10573 +21
- Misses 6276 6282 +6
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This certainly needs a changelog entry.
Most of my comments are nit picks, but while I see why it's easier for the backend to use a new kwargs, for UX I don't think we need a new kwarg to specify the name.
Some of the test/cloud changes are unrelated to this PR, now it's fine to leave them, but next time I think they worth to put them in separate, smaller PRs.
I also have one remote failure:
astroquery/mast/tests/test_mast.py ......................................... [ 51%]
astroquery/mast/tests/test_mast_remote.py .........................F........... [ 98%]
docs/mast/mast.rst s [100%]
===================================================================== FAILURES ======================================================================
_______________________________________________________ TestMast.test_catalogs_query_criteria _______________________________________________________
self = <astroquery.mast.tests.test_mast_remote.TestMast object at 0x14daf9d00>
def test_catalogs_query_criteria(self):
# clear columns config
mast.Catalogs._column_configs = dict()
# without position
result = mast.Catalogs.query_criteria(catalog="Tic", Bmag=[30, 50], objType="STAR")
assert isinstance(result, Table)
assert len(result) >= 10
assert result[np.where(result['ID'] == '81609218')]
result = mast.Catalogs.query_criteria(catalog="ctl", Tmag=[10.5, 11], POSflag="2mass")
assert isinstance(result, Table)
> assert len(result) >= 400
E assert 316 >= 400
E + where 316 = len(<Table masked=True length=316>\n ID version HIP TYC ... e_Dec_orig raddflag wdflag objID \n str9 ...... 70.0 1 0 137129648\n394245807 20190415 -- 9490-00757-1 ... 130.0 1 0 516829248)
astroquery/mast/tests/test_mast_remote.py:463: AssertionError
astroquery/mast/cutouts.py
Outdated
self._service_api_connection.set_service_params(services, "tesscut") | ||
|
||
def get_sectors(self, coordinates=None, radius=0*u.deg, objectname=None): | ||
def get_sectors(self, coordinates=None, radius=0*u.deg, objectname=None, moving_target=None, mt_type=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe now is a good time to make the kwargs mandatory kwargs given that only one of them can be provided?
def get_sectors(self, coordinates=None, radius=0*u.deg, objectname=None, moving_target=None, mt_type=None): | |
def get_sectors(self, *, coordinates=None, radius=0*u.deg, objectname=None, moving_target=None, mt_type=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever gets included in *
also needs to be added to params = {"obj_id": moving_target}
in L157 before the service call right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*
means that the rest of the parameters are keyword only, nothing additional is included in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see - learned something new today. This might be something worth starting a new PR over, since its a syntax change, we'd want to add the *
to all the Zcut methods as well, etc. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please do add it to all places where it makes sense, as separate PR sounds perfect, as it would allow us flexibility for the future as well as a safety-net against user bugs.
@@ -164,7 +195,8 @@ def get_sectors(self, coordinates=None, radius=0*u.deg, objectname=None): | |||
warnings.warn("Coordinates are not in any TESS sector.", NoResultsWarning) | |||
return Table(sector_dict) | |||
|
|||
def download_cutouts(self, coordinates=None, size=5, sector=None, path=".", inflate=True, objectname=None): | |||
def download_cutouts(self, coordinates=None, size=5, sector=None, path=".", inflate=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, make them kwargs only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a separate issue for this: #2267
else: | ||
|
||
# Get Skycoord object for coordinates/object | ||
coordinates = parse_input_location(coordinates, objectname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this has been the same before, but maybe it's worth using a different name here and below in the other methods, too that coordinates
that is also a non-parsed, and maybe None input kwarg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We rec would be to file and issue and have this be a seperate PR, bc this is the convention throughout the MAST module, so I think it would be clearer if they all got changed at once.
astroquery/mast/cutouts.py
Outdated
objectname : str, optional | ||
The target around which to search, by name (objectname="M104") | ||
or TIC ID (objectname="TIC 141914082"). | ||
One and only one of coordinates and objectname must be supplied. | ||
One and only one of coordinates, objectname, moving_target must be supplied. | ||
moving_target : str, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a new kwarg for moving targets? At the end of the day they are the name of the object to query, and from the user's pow I don't see a difference whether querying for M1 or Ceres.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @bsipocz , I've been tasked with addressing threads for this PR so it can get merged: From what I can tell it looks like there are two separate databases, and setting moving_target
will make the request call for the moving target database in MAST.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, so my reason for doing this was twofold:
- The resolving method for moving vs regular targets is completely different, and naming in astronomy is not always unique so I was worried about the user putting in a valid moving target and getting a stationary result.
- The output for moving targets is not quite the same as for regular targets, since it's a different type of cutout, so I thought it was clearer to keep the two queries more separate.
Both of these concerns could be addressed by having a moving target flag that defaults to false instead of a whole new argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming mess affects not just moving targets, I'm sure there is overlap within non-moving ones if we look closely, too, and also, the users don't need to know what's under the hood, that depending on the type of the object the query goes to a different database.
So, I find the logic of having a bool moving_target
clearer than basically having two separate APIs for the name depending on the service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a new commit that turns moving_target
into an optional bool argument. With your approvals, I'll make another commit to update the docstrings, tests, documentation, and collapse the commits into one.
astroquery/mast/observations.py
Outdated
self._cloud_connection.download_file(data_product, local_path, cache) | ||
except Exception as ex: | ||
log.exception("Error pulling from S3 bucket: {}".format(ex)) | ||
if self._cloud_connection is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this related to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an unrelated commit that was part of something else. I can make another commit to reverse these changes on my local branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably this was something else I was working on that accidentally got in. @jaymedina you might want to check what is on the main branch, and if this bit needs to be added in another PR or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to revert these changes to what's in the main
branch because it's following the same logic just written slightly differently, without the fall_back
trigger and a few other things.
|
||
.. code-block:: python | ||
|
||
>>> from astroquery.mast import Observations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks overindented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checked the rest of mast.rst
and the indentation is consistent with the rest of the document. I worry pulling it back will mess up the formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, then this is an issue for a separate quick cleanup PR.
docs/mast/mast.rst
Outdated
>>> single_obs = Observations.query_criteria(obs_collection="IUE",obs_id="lwp13058") | ||
>>> data_products = Observations.get_product_list(single_obs) | ||
|
||
>>> Observations.download_products(data_products, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
download_products
returns a table, maybe it's worth assigning it into a variable. However, it stays as is (I really don't have a strong preference), then include the table in the output below.
|
||
.. code-block:: python | ||
|
||
>>> from astroquery.mast import Tesscut |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I run into a timeout with this example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaymedina Try this example now, if I remember correctly the JPL horizons service was having timeout problems last August, so that might have been the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
In [3]: hdulist = Tesscut.get_cutouts(moving_target="Eleonora", size=5, sector=6
...: )
In [4]: hdulist[0].info()
Filename: <class '_io.BytesIO'>
No. Name Ver Type Cards Dimensions Format
0 PRIMARY 1 PrimaryHDU 54 ()
1 PIXELS 1 BinTableHDU 150 355R x 16C [D, E, J, 25J, 25E, 25E, 25E, 25E, J, E, E, 38A, D, D, D, D]
2 APERTURE 1 ImageHDU 97 (2136, 2078) int32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we have 355 rows now instead of 356. Must be a numpy thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ceb8 would you mind giving me writing access to your forked astroquery repo? I have some updates I need to commit to this branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaymedina you should have an invite now
I'll have to dig myself out of this again. In the meantime, tests look good. There's one test that was intentionally skipped because it retrieves too much data, which I'll revisit later - it's lower priority because I have some back-end tests running and this test executes, I'll take a look at it in the next sprint and see if I can recreate it for the GitHub tests:
|
@jaymedina Yes, a rebase is definitely in order, if you do that and are still having issued with stray commits, let me know. We might have to back out your changes, then rebase, then add them back in. |
6b04633
to
0b9c924
Compare
be272f0
to
6e91621
Compare
9110923
to
32c5844
Compare
Since
Update: Written tests results
|
The old dependencies and readthedocs checks are failing from not having the recent merge. Is it alright if I rebase really quick @bsipocz ? I have a backup branch ready. |
ca87911
to
ee0766d
Compare
No need to ask, do feel free to rebase, squash commits, etc as often as you need :) |
…, explicitly calling table variable to download_products output, and reverting changes made to observations.py
…wnload_cutouts, and get_cutouts.
…s, download_cutouts, and get_cutouts. also fixing import statements and other typos.
ee0766d
to
336e657
Compare
@jaymedina This is looking good. Is it ready to be merged, or are you planning to do anything else? |
Nope I’m done with the PR. Now just trying to figure out why the readthedocs check is failing, but the error messages aren’t giving me any hints. |
@jaymedina OK, I'll give it a last look over, and see whats up with the docs check in the next day or so. |
Thanks @jaymedina ! |
Thank you :) @ceb8 |
This needs a changelog entry, please open a separate PR for adding one, with using the number of this PR. |
Adding functionality to access the new MAST Moving Target TESScut functionality from the astroquery.mast Tesscut class.
Includes:
moving_target
argument to Tesscut class functions, that allows users to make cutouts for named moving targets (asteroids/comets etc).