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.
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.