Package uk.ac.starlink.ttools.task
Class PixSampler
java.lang.Object
uk.ac.starlink.ttools.task.PixSampler
Interrogates a HEALPix all-sky map to sample pixel data.
The map is supplied in the form of a table (one row per pixel,
using HEALPix pixel indices), as used for instance by
LAMBDA.
- Since:
- 5 Dec 2011
- Author:
- Mark Taylor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Defines how statistics are to be acquired from a pixel or set of pixels. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PixSampler.StatMode
StatMode for taking an average.static final PixSampler.StatMode
StatMode for making point samples. -
Constructor Summary
ConstructorsConstructorDescriptionPixSampler
(uk.ac.starlink.table.StarTable pixTable, boolean nested, int order) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic PixSampler
createPixSampler
(uk.ac.starlink.table.StarTable pixTable) Constructs a PixSampler from a given table.uk.ac.starlink.table.ColumnInfo[]
getValueInfos
(PixSampler.StatMode statMode) Returns the metadata for the columns output by the sampler.static Boolean
inferNested
(uk.ac.starlink.table.StarTable pixTable) Tries to work out whether a given table uses the nested or ring HEALPix ordering scheme.static int
inferOrder
(uk.ac.starlink.table.StarTable pixTable) Tries to work out the HEALPix order parameter for a pixel data table.sampleValue
(int icol, double alphaDeg, double deltaDeg, double radiusDeg, PixSampler.StatMode statMode) Samples a single value from a given sky position.Object[]
sampleValues
(double alphaDeg, double deltaDeg, double radiusDeg, PixSampler.StatMode statMode) Samples values from all columns in given table at a given sky position.
-
Field Details
-
POINT_MODE
StatMode for making point samples. -
MEAN_MODE
StatMode for taking an average.
-
-
Constructor Details
-
PixSampler
public PixSampler(uk.ac.starlink.table.StarTable pixTable, boolean nested, int order) throws IOException Constructor.- Parameters:
pixTable
- random access HEALPix-format table (one row per pixel)nested
- true for nested pixel order, false for ringorder
- HEALPix order- Throws:
IOException
- if the table has the wrong number of rows or is not random access
-
-
Method Details
-
sampleValue
public Object sampleValue(int icol, double alphaDeg, double deltaDeg, double radiusDeg, PixSampler.StatMode statMode) throws IOException Samples a single value from a given sky position.- Parameters:
icol
- column index of value to samplealphaDeg
- longitude position in degreesdeltaDeg
- latitude position in degreesradiusDeg
- radius of disc over which statistics will be gathered (ignored for point-like statMode)statMode
- mode for sampling statistics- Returns:
- sampled value at given point
- Throws:
IOException
-
sampleValues
public Object[] sampleValues(double alphaDeg, double deltaDeg, double radiusDeg, PixSampler.StatMode statMode) throws IOException Samples values from all columns in given table at a given sky position.- Parameters:
alphaDeg
- longitude position in degreesdeltaDeg
- latitude position in degreesradiusDeg
- radius of disc over which statistics will be gathered (ignored for point-like statMode)statMode
- mode for sampling statistics- Returns:
- array of sampled column values at given point
- Throws:
IOException
-
getValueInfos
Returns the metadata for the columns output by the sampler.- Parameters:
statMode
- mode for sampling statistics- Returns:
- array of output metadata objects, one for each output column
-
createPixSampler
public static PixSampler createPixSampler(uk.ac.starlink.table.StarTable pixTable) throws IOException Constructs a PixSampler from a given table. The current implementation works with any table having a row count corresponding to a HEALPix pixel count, the order is inferred.- Parameters:
pixTable
- random access table containing HEALPix pixels- Returns:
- PixSampler object taking data from table
- Throws:
IOException
- if table is not random access or does not appear to contain HEALPix data
-
inferNested
Tries to work out whether a given table uses the nested or ring HEALPix ordering scheme.- Parameters:
pixTable
- pixel data table- Returns:
- TRUE for nested, FALSE for ring, null for don't know
-
inferOrder
Tries to work out the HEALPix order parameter for a pixel data table. Mainly it looks at the row count, but if the table obeys HEALPix header conventions any discrepancies between declared and apparent order result in an error.- Parameters:
pixTable
- pixel data table- Returns:
- HEALPix order
- Throws:
IOException
-