<?xml version="1.0" encoding="utf-8"?>
<!-- the endless lightcurve, images and folded lightcurves -->

<resource resdir="inflight" schema="inflight">

	<meta name="creationDate">2007-12-02T12:00:00Z</meta>
	<meta name="schema-rank">100</meta>

	<meta name="subject">weak-gravitational-lensing</meta>
	<meta name="subject">photometry</meta>
	<meta name="subject">astronomical-simulations</meta>

	<meta name="title">The Endless Lightcurve</meta>
	<meta name="referenceURL">http://www.ari.uni-heidelberg.de/mitarbeiter/rschmidt/papers/</meta>
	<meta name="description">The infinite lightcurve is a continuously calculated
	microlensing lightcurve, simulating the light variation of a quasar due to
	an intervening star field.</meta>
	<meta name="copyright" format ="plain">Lightcurve computed by Robert Schmidt.  If you
	use this data, please acknowledge this web page. Visualization by M. Demleitner/U.Stampa.</meta>
	<meta name="_longdoc" format="rst">The source radii are given in units
	of 0.01 Einstein radii.</meta>

	<table id="data" onDisk="true" adql="True">
		<meta name="description">The raw lensing data as well as
			relative intensities computed for various source profiles.</meta>
		<index columns="line" cluster="True"/>

		<column name="line" type="integer" required="True"
			tablehead="Distance" verbLevel="1" ucd="pos.distance"
			description="Distance indicator in 0.01 Einstein radii"/>
		<column name="data" type="text"
			description="Base64 encoded 8-bit image data"
			tablehead="Image data"/>
		<column name="srcname" type="text"
			description="Name of file this line came from"
			tablehead="Source file name" verbLevel="40" ucd="meta.ref"/>
		<LOOP>
			<csvItems>
				radius, item
				1, 01
				2, 02
				4, 04
				6, 06
				8, 08
				10, 10
				12, 12
				16, 16
				20, 20
				24, 24
				28, 28
				32, 32
				40, 40
				48, 48
			</csvItems>
			<events>
				<column name="gauss\item" unit="mag" verbLevel="12"
						description="Magnification for a Gauss disk source with r=\radius"
						displayHint="sf=3" tablehead="Gauss \radius"
						ucd="phot.mag;arith.diff">
					<property name="srcPath"
						>data/light/gauss/\radius.000/light%04d_gauss_\radius.000.txt</property>
				</column>
			</events>
		</LOOP>
		<column name="thin01" tablehead="Thin 01"
			unit="mag" verbLevel="1" displayHint="sf=3"
			description="Amplification of a thin disk of r=1"
			ucd="phot.mag;arith.diff;meta.main">
			<property name="srcPath"
				>data/light/thin/1.000/light%04d_thin_1.000.txt</property>
		</column>
		<LOOP>
			<csvItems>
				radius, item
				2, 02
				4, 04
				6, 06
				8, 08
				10, 10
				12, 12
				16, 16
				20, 20
				24, 24
				28, 28
			</csvItems>
			<events>
				<column name="thin\item" unit="mag" verbLevel="12"
						description="Magnification for thin disk with r=\radius"
						displayHint="sf=3" tablehead="Thin \radius"
						ucd="phot.mag;arith.diff">
					<property name="srcPath"
						>data/light/thin/\radius.000/light%04d_thin_\radius.000.txt</property>
				</column>
			</events>
		</LOOP>
	</table>

	<data id="import">
		<sources pattern="data/patterns/MAGPAT*"/>
		<property name="upperCutoff">1500</property>
		<property name="lowerCutoff">500</property>
		<property name="roiWidth">300</property>
		<customGrammar module="res/grammar">
			<property name="imageDimension">1000</property>
			<property name="offsetsFile">res/offsets</property>
		</customGrammar>
		<make table="data"/>
	</data>

	<dbCore id="queryLines" queriedTable="data" limit="32768"
			sortKey="line">
		<condDesc buildFrom="line"/>
	</dbCore>

	<service id="img" core="queryLines" allowed="custom"
			customPage="res/jpegrender">
		<meta name="_intro" format="plain">To obtain a parts of the
		source image the infinite
		lightcurve was generated from, enter something like 200 .. 500 (mind the
		blanks!) to get lines 200 through 500.  Image generation will fail
		if you try images larger than 32768 lines (this is a jpeg limitation).
		</meta>
		<meta name="_related" title="Scrolling Infinite Lightcurve"
			>/inflight/res/lc1/ui/fixed</meta>
		<meta name="_related" title="Tables of the Infinite Lightcurve"
			>/inflight/res/lc1/table/form</meta>

		<meta name="shortName">inflight_img</meta>
		<meta name="title">The Infinite Lightcurve, Images</meta>
		<meta name="_title">Images from the Infinite Lightcurve</meta>
		<meta name="description">Images from the infinite microlensing
			lightcurve selectable through text queries.</meta>
		<property name="curveMax">2.5</property>
		<property name="curveMin">-2.5</property>
		<outputTable namePath="data">
			<outputField original="line"/>
			<outputField original="data"/>
		</outputTable>

		<inputKey name="palette" tablehead="Palette" multiplicity="single"
				description="Palette to use for coloring (empty for b/w)"
				type="text">
			<values default="b/w" nullLiteral="">
				<option>b/w</option>
				<option>coldfire</option>
				<option>gold</option>
				<option>plasma</option>
				<option>rainbow</option>
			</values>
		</inputKey>

		<inputKey name="plotField" type="text"
				tablehead="Source Profile" multiplicity="single">
			<values>
				<LOOP>
					<codeItems>
						for title in sorted([
							item.name for item in context.getById("data")
								if item.getProperty("srcPath", None) is not None]):
							yield {"title": title}
					</codeItems>
					<events>
						<option>\title</option>
					</events>
				</LOOP>
			</values>
		</inputKey>
	</service>

	<dbCore id="queryTable" queriedTable="data" namePath="data">
		<condDesc buildFrom="line"/>
	</dbCore>

	<service id="table" core="queryTable">
		<meta name="shortName">inflight_table</meta>
		<meta name="title">The Infinite Lightcurve, Tables</meta>
		<publish render="form" sets="local" service="table"/>
		<meta name="description">Tables from the infinite microlensing
			lightcurve selectable through text queries.</meta>
		<meta name="_related" title="Images of the Infinite Lightcurve"
			>/inflight/res/lc1/img/img.jpeg</meta>
		<meta name="_related" title="Scrolling Infinite Lightcurve"
			>/inflight/res/lc1/ui/fixed</meta>

		<outputTable namePath="data">
			<outputField original="line"/>
			<outputField original="thin01"/>
		</outputTable>
	</service>

	<nullCore id="null"/>

	<service id="ui" allowed="fixed,static" core="null">
		<property name="staticData">static</property>
		<publish render="fixed" sets="local,ivo_managed"/>
		<meta name="shortName">inflight_gui</meta>
		<meta name="title">The Scrolling Infinite Lightcurve</meta>
		<meta name="description">A web-based GUI to the infinite microlensing
			lightcurve.</meta>
		<meta name="_related" title="Images of the Infinite Lightcurve"
			>/inflight/res/lc1/img/img.jpeg</meta>
		<meta name="_related" title="Tables of the Infinite Lightcurve"
			>/inflight/res/lc1/table/form</meta>

		<template key="fixed">res/ui.template</template>
	</service>

	<regSuite title="Infinite Lightcurve">
		<regTest title="Lightcurve FITS looks like a binary FITS table">
			<url parSet="form" MAXREC="100" line="2 .. 5"
				_VERB="2" _FORMAT="FITS">table/form</url>
			<code>
				self.assertHasStrings("'BINTABLE'",
					"TTYPE1  = 'line    '  ",
					"TFORM1  = 'J       '  ",)
			</code>
		</regTest>

		<regTest title="Infinite Lightcurve image delivery">
			<url endLine="30" startLine="20" plotField="thin01"
				palette="">/inflight/res/lc1/img/custom</url>
			<code>
				self.assertHasStrings(
					b'\\xff\\xd8\\xff\\xe0\\x00\\x10JFIF\\x00\\x01\\x01\\x00'
					b'\\x00\\x01\\x00\\x01\\x00\\x00')
				self.assertTrue(len(self.data)&lt;60000)
			</code>
		</regTest>
	</regSuite>
</resource>
