Class BinaryDataProvider
java.lang.Object
gaiasky.data.group.AbstractStarGroupDataProvider
gaiasky.data.group.BinaryDataProvider
- All Implemented Interfaces:
IParticleGroupDataProvider, IStarGroupDataProvider
Reads binary files using the infrastructure under
BinaryIO. The format includes a header token
and a version number. Depending on the version number a different loader is activated.-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractStarGroupDataProvider
AbstractStarGroupDataProvider.AdditionalCols, AbstractStarGroupDataProvider.ColIdModifier and TypeClassDescriptionstatic classstatic enumRepresents a column type. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intThe default output format version to use for writingstatic intstatic intFields inherited from class AbstractStarGroupDataProvider
adaptiveParallax, additional, additionalFiles, colors, countsPerMag, distCap, fileNumberCap, indexMap, list, logger, magCorrections, mustLoadIds, parallaxErrorFactorBright, parallaxErrorFactorFaint, parallaxZeroPoint, parallelism, params, ruwe, sphericalPositions, starNumberCap, transformModifier and TypeFieldDescriptionprotected booleanWhether to use an adaptive threshold which lets more bright stars in to avoid artifacts.protected List<AbstractStarGroupDataProvider.AdditionalCols> protected String[]Files or folders with optionally gzipped CSVs containing additional columns to be matched by sourceId with the main catalog.protected com.badlogic.gdx.utils.LongMap<float[]> protected long[]protected doubleDistance cap in parsecsprotected intMaximum number of files to load.protected Map<AbstractStarGroupDataProvider.ColId, Integer> protected List<IParticleRecord> protected static Logger.Logprotected booleanApply magnitude/color corrections for extinction/reddeningprotected doubleThe loader will only load stars for which the parallax error is at most the percentage given here, in [0..1].protected doubleThe loader will only load stars for which the parallax error is at most the percentage given here, in [0..1].protected doubleThe zero point for the parallaxes in mas.protected final intParallelism valueprotected DoubleRUWE cap value.protected com.badlogic.gdx.utils.LongMap<double[]> protected intMaximum number of files to load per fileprotected Matrix4D -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionloadData(InputStream is, double factor) Loads the data applying a factor.Loads the data applying a factor.loadDataMapped(String file, double factor) Loads the data applying a factor using a memory mapped file for improved speed.loadDataMapped(String file, double factor, int versionHint) Loads data mapped with a version hint.readData(InputStream in, double factor) voidsetOutputFormatVersion(int version) Set the preferred output format version, if applicable.voidwriteData(List<IParticleRecord> data, OutputStream out) voidwriteData(List<IParticleRecord> data, OutputStream out, int version) Methods inherited from class AbstractStarGroupDataProvider
acceptDistance, acceptParallax, colIdFromStr, countLines, countLines, dumpToDisk, dumpToDiskBin, dumpToDiskCsv, getAdditionalValue, getColors, getCountsPerMag, getGeoDistance, getRuweValue, hasAdditional, hasAdditionalColumn, hasCol, idx, initLists, initLists, initLists, loadData, mustLoad, setAdaptiveParallax, setAdditionalFiles, setColumns, setDistanceCap, setFileNumberCap, setMagCorrections, setMustLoadIds, setParallaxErrorFactorBright, setParallaxErrorFactorFaint, setParallaxZeroPoint, setProviderParams, setRUWECap, setStarNumberCap, setTransformMatrixModifier and TypeMethodDescriptionprotected booleanacceptDistance(double distance) Checks whether to accept the distanceprotected booleanacceptParallax(double appMag, double parallax, double parallaxError) Checks whether the parallax is accepted or not.colIdFromStr(String name) protected intcountLines(com.badlogic.gdx.files.FileHandle f) protected intCounts the lines on this input streamprotected voiddumpToDisk(List<IParticleRecord> data, String filename, String format) protected voiddumpToDiskBin(List<IParticleRecord> data, String filename) protected voiddumpToDiskCsv(List<IParticleRecord> data, String filename) protected DoublegetAdditionalValue(AbstractStarGroupDataProvider.ColId col, Long sourceId) com.badlogic.gdx.utils.LongMap<float[]> long[]Gets the star counts per magnitude.protected doublegetGeoDistance(long sourceId) Gets the distance in parsecs to the star from the additional columns map, if it exists.protected floatgetRuweValue(long sourceId, String[] tokens) protected booleanhasAdditional(AbstractStarGroupDataProvider.ColId col, Long sourceId) protected booleanprotected booleanprotected intprotected voidprotected voidinitLists(int elems) Initialises the lists and structures given number of elementsprotected voidinitLists(com.badlogic.gdx.files.FileHandle f) Initialises the lists and structures given a file by counting the number of linesLoads the data as it is.protected booleanmustLoad(long id) Returns whether the star must be loaded or notvoidsetAdaptiveParallax(boolean adaptive) Whether to use an adaptive threshold, relaxing it for bright (appmag ≥ 13) stars to let more bright stars in.voidsetAdditionalFiles(String additionalFiles) Set location of additional columns file or directory.voidsetColumns(String columns) List of column names, separated by commas, indicating the position of each field to load.voidsetDistanceCap(double distCap) Sets a distance cap.voidsetFileNumberCap(int cap) Sets a cap on the number of files to load.voidsetMagCorrections(boolean magCorrections) Sets the flag to apply magnitude and color corrections for extinction and reddening.voidsetMustLoadIds(Set<Long> ids) Adds a set with all the ids which will be loaded regardless of any other conditions (i.e.voidsetParallaxErrorFactorBright(double parallaxErrorFactor) The loader will only load stars for which the parallax error is at most the percentage given here, in [0..1].voidsetParallaxErrorFactorFaint(double parallaxErrorFactor) The loader will only load stars for which the parallax error is at most the percentage given here, in [0..1].voidsetParallaxZeroPoint(double parallaxZeroPoint) Sets the zero point of the parallax as an addition to the parallax values, in [mas].voidsetProviderParams(Map<String, Object> params) Set provider parameters as a map.voidsetRUWECap(double RUWE) Sets the RUWE criteria.voidsetStarNumberCap(int starNumberCap) Sets the maximum number of stars to be processed per file.voidsetTransformMatrix(Matrix4D transform) Sets a transform matrix to apply to all data points.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IParticleGroupDataProvider
isUniformEpochModifier and TypeMethodDescriptiondefault booleanDo all particles in the group have the same epoch?
-
Field Details
-
DEFAULT_OUTPUT_VERSION
public static int DEFAULT_OUTPUT_VERSIONThe default output format version to use for writing -
MIN_OUTPUT_VERSION
public static int MIN_OUTPUT_VERSION -
MAX_OUTPUT_VERSION
public static int MAX_OUTPUT_VERSION
-
-
Constructor Details
-
BinaryDataProvider
public BinaryDataProvider()
-
-
Method Details
-
loadData
Description copied from interface:IStarGroupDataProviderLoads the data applying a factor.- Parameters:
file- The file to load.factor- Factor to apply to the positions.- Returns:
- The array of particle records.
-
loadData
Description copied from interface:IStarGroupDataProviderLoads the data applying a factor.- Parameters:
is- Input stream to load the data from.factor- Factor to apply to the positions.- Returns:
- The array of particle records.
-
writeData
-
writeData
-
readData
-
loadDataMapped
Description copied from interface:IStarGroupDataProviderLoads the data applying a factor using a memory mapped file for improved speed.- Parameters:
file- The file to load.factor- Factor to apply to the positions.- Returns:
- The array of particle records.
-
loadDataMapped
Loads data mapped with a version hint.- Parameters:
file- The file to loadfactor- Distance factor, if anyversionHint- Data version number, in case of version 0 or 1, since these formats were not annotated. If version >=2, the version number is read from the file header- Returns:
- The list of particle records.
-
setOutputFormatVersion
public void setOutputFormatVersion(int version) Description copied from interface:IStarGroupDataProviderSet the preferred output format version, if applicable.- Specified by:
setOutputFormatVersionin interfaceIStarGroupDataProvider- Overrides:
setOutputFormatVersionin classAbstractStarGroupDataProvider- Parameters:
version- The version number.
-