You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using datalink, one sometimes wants to go back to the table row the datalink originally came from. As an example, assume you want to make Hα maps from spectral cubes; you will need the redshift of the source object for that, and that you can presumably only get from the original record.
Here's some code illustrating the problem:
import pyvo
l0 = 6.5625e-7
svc = pyvo.dal.TAPService("http://dc.g-vo.org/tap")
results = svc.run_sync("select top 5 * from califa.cubes
natural join califa.objects")
for dl in results.iter_datalinks():
redshift = *** dl.original["redshift"] ***
lobs = l0*(1+redshift)
map = next(dl.bysemantics("#this")).processed(band=(lobs, lobs))
The trouble: This doesn't work at the moment, because there's no "original" attribute on DatalinkRecord-s. To work around this, people would have to figure out the key used by the datalink machinery (which, incidentally, is not pretty in pyVO either, but that's perhaps not a real problem) and then go back to the original table with the datalink.id. That's really not nice.
What I'd suggest instead is that we add an attribute ("original" is perhaps not the best name) or a function ("get_originating_row()") that makes it easy to pull out the record in the original table corresponding to datalink.id.
Opinions? I'd donate an implementation (which shouldn't be hard anyway), but I'd first like to make sure I'm not missing anything -- and whether anyone has ideas for how to make this a pretty and obvious API.
The text was updated successfully, but these errors were encountered:
msdemlei
added a commit
to msdemlei/pyvo
that referenced
this issue
Jun 20, 2024
This is intended to fixastropy#542.
It also does some minor improvements to the documentation of how to use
datalink. But that part could really use a lot more love...
msdemlei
added a commit
to msdemlei/pyvo
that referenced
this issue
Jun 26, 2024
This is intended to fixastropy#542.
It also does some minor improvements to the documentation of how to use
datalink. But that part could really use a lot more love...
msdemlei
added a commit
to msdemlei/pyvo
that referenced
this issue
Jun 27, 2024
This is intended to fixastropy#542.
It also does some minor improvements to the documentation of how to use
datalink. But that part could really use a lot more love...
When using datalink, one sometimes wants to go back to the table row the datalink originally came from. As an example, assume you want to make Hα maps from spectral cubes; you will need the redshift of the source object for that, and that you can presumably only get from the original record.
Here's some code illustrating the problem:
The trouble: This doesn't work at the moment, because there's no "original" attribute on DatalinkRecord-s. To work around this, people would have to figure out the key used by the datalink machinery (which, incidentally, is not pretty in pyVO either, but that's perhaps not a real problem) and then go back to the original table with the datalink.id. That's really not nice.
What I'd suggest instead is that we add an attribute ("original" is perhaps not the best name) or a function ("get_originating_row()") that makes it easy to pull out the record in the original table corresponding to datalink.id.
Opinions? I'd donate an implementation (which shouldn't be hard anyway), but I'd first like to make sure I'm not missing anything -- and whether anyone has ideas for how to make this a pretty and obvious API.
The text was updated successfully, but these errors were encountered: