MatchEngine
public class ErrorSkyMatchEngine extends AbstractSkyMatchEngine
Number
objects, representing Right Ascension, Declination, and error radius
respectively, all in radians. Other similar longitude/latitude-like
coordinate system may alternatively be used.
Two tuples are considered to match if the distance along a great circle
of their central positions is no greater than the sum of their per-object
radii.
A length scale must be supplied, which should be of comparable size to the average per-object error, and which affects performance but not the result. The effect of this is to provide a default for the pixellisation tuning parameter. If the tuning parameter is set directly, the length scale is ignored.
NO_BINS
Constructor | Description |
---|---|
ErrorSkyMatchEngine(SkyPixellator pixellator,
double scale) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
canBoundMatch() |
Indicates that the
MatchEngine.getMatchBounds(uk.ac.starlink.table.join.NdRange[], int) method can be invoked
to provide some sort of useful result. |
java.lang.Object[] |
getBins(java.lang.Object[] tuple) |
Returns a set of keys for bins into which possible matches for
a given tuple might fall.
|
NdRange |
getMatchBounds(NdRange[] inRanges,
int index) |
Given a range of tuple values, returns a range outside which
no match to anything within that range can result.
|
DescribedValue[] |
getMatchParameters() |
Returns a set of DescribedValue objects whose values can be modified
to modify the matching criteria.
|
ValueInfo |
getMatchScoreInfo() |
Returns a description of the value returned by the
MatchEngine.matchScore(java.lang.Object[], java.lang.Object[]) method. |
double |
getScale() |
Returns the length scale.
|
double |
getScoreScale() |
Returns unity.
|
ValueInfo[] |
getTupleInfos() |
Returns a set of ValueInfo objects indicating what is required for
the elements of each tuple.
|
double |
matchScore(java.lang.Object[] tuple1,
java.lang.Object[] tuple2) |
Indicates whether two tuples count as matching each other, and if
so how closely.
|
void |
setScale(double scale) |
Sets the length scale.
|
java.lang.String |
toString() |
calculateSeparation, getTuningParameters
public ErrorSkyMatchEngine(SkyPixellator pixellator, double scale)
pixellator
- handles sky pixellisationscale
- initial value for length scale, in radianspublic void setScale(double scale)
setScale
in class AbstractSkyMatchEngine
scale
- rough value of per-object errors, in radianspublic double getScale()
getScale
in class AbstractSkyMatchEngine
public ValueInfo[] getTupleInfos()
MatchEngine
public DescribedValue[] getMatchParameters()
MatchEngine
DescribedValue.setValue(java.lang.Object)
on the
returned objects.public ValueInfo getMatchScoreInfo()
MatchEngine
MatchEngine.matchScore(java.lang.Object[], java.lang.Object[])
method. The content class should be numeric
(though need not be Double
), and the name,
description and units should be descriptive of whatever the
physical significance of the value is.
If the result of matchScore
is not interesting
(for instance, if it's always either 0 or -1),
null
may be returned.public double matchScore(java.lang.Object[] tuple1, java.lang.Object[] tuple2)
MatchEngine
If there's no reason to do otherwise, the range 0..1 is recommended for successul matches. However, if the result has some sort of physical meaning (such as a distance in real space) that may be used instead.
tuple1
- one tupletuple2
- the other tuplepublic double getScoreScale()
public java.lang.Object[] getBins(java.lang.Object[] tuple)
MatchEngine
tuple
- tuplepublic boolean canBoundMatch()
MatchEngine
MatchEngine.getMatchBounds(uk.ac.starlink.table.join.NdRange[], int)
method can be invoked
to provide some sort of useful result.public NdRange getMatchBounds(NdRange[] inRanges, int index)
MatchEngine
Both the input and output rectangles are specified by tuples representing its opposite corners; equivalently, they are the minimum and maximum values of each tuple element. In either the input or output min/max tuples, any element may be null to indicate that no information is available on the bounds of that tuple element (coordinate).
An array of n-dimensional ranges is given, though only one of them
(specified by the index
value) forms the basis for
the output range. The other ranges in the input array may in some
cases be needed as context in order to do the calculation.
If the match error is fixed, only the single input n-d range is needed
to work out the single output range. However, if the errors are
obtained by looking at the tuples themselves (match errors are per-row)
then in general the broadening has to be done using the maximum
error of any of the tables involved in the match,
not just the one to be broadened.
For a long time, I didn't realise this, so versions of this software
up to STIL v3.0-14 (Oct 2015) were not correctly broadening these
ranges, leading to potentially missed associations near the edge
of bounded regions.
This method can be used by match algorithms which know in advance the range of coordinates they will match against and wish to reduce workload by not attempting matches which are bound to fail.
For example, a 1-d Cartesian match engine with an isotropic match error 0.5 would turn input values of ((0,200),(10,210)) into output values ((-0.5,199.5),(10.5,210.5)).
This method will only be called if MatchEngine.canBoundMatch()
returns true. Thus engines that cannot provide any useful
information along these lines (for instance because none of its
tuple elements is Comparable
) do not need to
implement it in a meaningful way.
inRanges
- array of input ranges for the tables on which
the match will take place;
each element bounds the values for each tuple
element in its corresponding table
in a possible match
(to put it another way - each element gives the
coordinates of the opposite corners of a tuple-space
rectangle covered by one input table)index
- which element of the inRanges
array
for which the broadened output value is requiredinRanges[index]
broadened by errorsMatchEngine.canBoundMatch()
public java.lang.String toString()
toString
in class AbstractSkyMatchEngine
Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.