\now \commonmeta %one of survey, pointed, theory, custom, artificial)% %one of archival, cutout, filtered, mosaic, projection, spectralExtraction, catalogExtraction% spectrum MAXREC=1 //products#table//ssap#plainlocation//ssap#simpleCoverage application/x-votable+xml;content=datalink Datalink %add further custom columns if necessary here%
previews "\\schema.raw_data" "fullDLURL{sdl}" %typical size of an SDM VOTable in bytes% "application/x-votable+xml" \\standardPreviewPath "image/png" %use getWCSAxis(@header_, 1) for IRAF FITSes (delete otherwise)% %where to get the RA from% %where to get the Dec from% %the aperture (a constant estimate may just do it)% dateTimeToMJD(parseTimestamp(@%key for dateObs%, "%Y-%m-%d %H:%M:%S")) "{} {}".format(%make a string halfway human-readable and halfway unique for each data set%) %which header to get the target name from% %typically, @specAx.pixToPhys(1)*1e-10% %typically, @specAx.pixToPhys(@specAx.axisLength)*1e-10% %typically, @specAx.axisLength% %where to get an exposure time from% %expression to compute the typical spectral FWHM *in meters*% //ssap#view //obscore#publishSSAPMIXC //ssap#sdm-instance%a few words what a spectrum represents%
# we receive a pubDID in self.sourceToken["ssa_pubDID"]; # the physical accref is behind its "?", potentially URL-encoded. sourcePath = os.path.join( base.getConfig("inputsDir"), urllib.parse.unquote( self.sourceToken["ssa_pubDID"].split('?', 1)[-1])) % add code returning rowdicts from sourcePath % # In the common case of 1D FITS images repurposed a a spectrum # this could be something like # fitsPath = products.RAccref.fromString( # self.sourceToken["accref"]).localpath # hdus = pyfits.open(fitsPath) # ax = utils.getWCSAxis(hdus[0].header, 1) # for spec, flux in enumerate(hdus[0].data): # yield {"spectral": ax.pix0ToPhys(spec), "flux": flux} # hdus.close() \\schema Datalink Service "\\rdId#data" "\\rdId#build_spectrum" if descriptor.pubDID is None: return # this assumes normal accref computation: the original file # then is just inputsDir/accref yield descriptor.makeLinkFromFile( base.getConfig("inputsDir") / descriptor.accref, description="Spectrum as the original 1D array") \\schema Web accref, mime, ssa_targname, ssa_aperture, ssa_dateObs, datalink \\schema SSAP full auto%delete this line if you have no previews; else delete just this.% ssa/ssap.xml self.assertHasStrings( "%some characteristic string returned by the query%", "%another characteristic string returned by the query%") sdl/dlmeta by_sem = self.datalinkBySemantics() print(by_sem) self.fail("Fill this in") sdl/dlget self.assertHasStrings( "%some characteristic string in the datalink meta%") ]]>