Class AbstractStarGroupDataProvider
- java.lang.Object
-
- gaiasky.data.group.AbstractStarGroupDataProvider
-
- All Implemented Interfaces:
IParticleGroupDataProvider,IStarGroupDataProvider
- Direct Known Subclasses:
BinaryDataProvider,DR2DataProvider,SerializedDataProvider,STILDataProvider
public abstract class AbstractStarGroupDataProvider extends java.lang.Object implements IStarGroupDataProvider
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanadaptiveParallaxWhether to use an adaptive threshold which lets more bright stars in to avoid artifacts.protected com.badlogic.gdx.utils.LongMap<float[]>colorsprotected long[]countsPerMagprotected doubledistCapDistance cap in parsecsprotected LargeLongMap<java.lang.Double>geoDistancesprotected longgeoDistErrorsErrors (negative or nan values) reading geometric distance filesprotected java.lang.StringgeoDistFilePoints to the location of a file or directory which contains a set ofprotected com.badlogic.gdx.utils.Array<StarGroup.StarBean>listprotected static Logger.Logloggerprotected booleanmagCorrectionsApply magnitude/color corrections for extinction/reddeningprotected java.util.Set<java.lang.Long>mustLoadIdsstatic doubleNEGATIVE_DISTprotected doubleparallaxErrorFactorBrightThe loader will only load stars for which the parallax error is at most the percentage given here, in [0..1].protected doubleparallaxErrorFactorFaintThe loader will only load stars for which the parallax error is at most the percentage given here, in [0..1].protected doubleparallaxZeroPointThe zero point for the parallaxes in mas.protected java.lang.DoubleruweRUWE cap value.protected java.lang.StringruweFileLocation of gzipped file withprotected LargeLongMap<java.lang.Float>ruweValuesprotected com.badlogic.gdx.utils.LongMap<double[]>sphericalPositions
-
Constructor Summary
Constructors Constructor Description AbstractStarGroupDataProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanacceptDistance(double distance)Checks whether to accept the distanceprotected booleanacceptParallax(double appmag, double pllx, double pllxerr)Checks whether the parallax is accepted or not.protected intcountLines(com.badlogic.gdx.files.FileHandle f)protected intcountLines(java.io.InputStream is)Counts the lines on this input streamprotected voiddumpToDisk(com.badlogic.gdx.utils.Array<StarGroup.StarBean> data, java.lang.String filename, java.lang.String format)protected voiddumpToDiskBin(com.badlogic.gdx.utils.Array<StarGroup.StarBean> data, java.lang.String filename, boolean serialized)protected voiddumpToDiskCsv(com.badlogic.gdx.utils.Array<StarGroup.StarBean> data, java.lang.String filename)com.badlogic.gdx.utils.LongMap<float[]>getColors()long[]getCountsPerMag()Gets the star counts per magnitudeprotected doublegetGeoDistance(long sourceId)Gets the distance in parsecs to the star from the geometric distances map, if it exists.protected floatgetRuweValue(long sourceId)protected booleanhasGeoDistance(long sourceId)protected booleanhasGeoDistances()protected voidinitLists()protected 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 linesprotected 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.voidsetDistanceCap(double distCap)Sets a distance cap.voidsetFileNumberCap(int cap)Sets a cap on the number of files to load.voidsetGeoDistancesFile(java.lang.String geoDistFile)Sets the location of the geometric distances file or directoryvoidsetMagCorrections(boolean magCorrections)Sets the flag to apply magnitude and color corrections for extinction and reddeningvoidsetMustLoadIds(java.util.Set<java.lang.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]voidsetRUWECap(double RUWE)Sets the RUWE criteria.voidsetRUWEFile(java.lang.String RUWEFile)Sets the location of the gzipped RUWE file-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gaiasky.data.group.IParticleGroupDataProvider
loadData, loadData, loadData, loadDataMapped
-
-
-
-
Field Detail
-
logger
protected static Logger.Log logger
-
NEGATIVE_DIST
public static double NEGATIVE_DIST
-
list
protected com.badlogic.gdx.utils.Array<StarGroup.StarBean> list
-
sphericalPositions
protected com.badlogic.gdx.utils.LongMap<double[]> sphericalPositions
-
colors
protected com.badlogic.gdx.utils.LongMap<float[]> colors
-
countsPerMag
protected long[] countsPerMag
-
geoDistances
protected LargeLongMap<java.lang.Double> geoDistances
-
ruweValues
protected LargeLongMap<java.lang.Float> ruweValues
-
mustLoadIds
protected java.util.Set<java.lang.Long> mustLoadIds
-
geoDistFile
protected java.lang.String geoDistFile
Points to the location of a file or directory which contains a set of
-
ruweFile
protected java.lang.String ruweFile
Location of gzipped file with
-
ruwe
protected java.lang.Double ruwe
RUWE cap value. Will accept all stars with star_ruwe <= ruwe
-
geoDistErrors
protected long geoDistErrors
Errors (negative or nan values) reading geometric distance files
-
distCap
protected double distCap
Distance cap in parsecs
-
parallaxErrorFactorFaint
protected double parallaxErrorFactorFaint
The loader will only load stars for which the parallax error is at most the percentage given here, in [0..1]. Faint stars (gmag >= 13.1) More specifically, the following must be met:
pllx_err < pllx * pllxErrFactor
-
parallaxErrorFactorBright
protected double parallaxErrorFactorBright
The loader will only load stars for which the parallax error is at most the percentage given here, in [0..1]. Bright stars (gmag < 13.1) More specifically, the following must be met:
pllx_err < pllx * pllxErrFactor
-
adaptiveParallax
protected boolean adaptiveParallax
Whether to use an adaptive threshold which lets more bright stars in to avoid artifacts.
-
parallaxZeroPoint
protected double parallaxZeroPoint
The zero point for the parallaxes in mas. Gets added to all loaded parallax values
-
magCorrections
protected boolean magCorrections
Apply magnitude/color corrections for extinction/reddening
-
-
Method Detail
-
initLists
protected void initLists(com.badlogic.gdx.files.FileHandle f)
Initialises the lists and structures given a file by counting the number of lines- Parameters:
f- The file handle to count the lines
-
initLists
protected void initLists(int elems)
Initialises the lists and structures given number of elements- Parameters:
elems-
-
initLists
protected void initLists()
-
mustLoad
protected boolean mustLoad(long id)
Returns whether the star must be loaded or not- Parameters:
id- The star ID- Returns:
- Whether the star with the given ID must be loaded
-
acceptParallax
protected boolean acceptParallax(double appmag, double pllx, double pllxerr)Checks whether the parallax is accepted or not.If adaptive is not enabled:
accepted = pllx > 0 && pllx_err < pllx * pllx_err_factor && pllx_err <= 1
If adaptive is enabled:
accepted = pllx > 0 && pllx_err < pllx * max(0.5, pllx_err_factor) && pllx_err <= 1, if apparent_magnitude < 13.2 accepted = pllx > 0 && pllx_err < pllx * pllx_err_factor && pllx_err <= 1, otherwise
- Parameters:
appmag- Apparent magnitude of starpllx- Parallax of starpllxerr- Parallax error of star- Returns:
- True if parallax is accepted, false otherwise
-
getRuweValue
protected float getRuweValue(long sourceId)
-
getGeoDistance
protected double getGeoDistance(long sourceId)
Gets the distance in parsecs to the star from the geometric distances map, if it exists. Otherwise, it returns a negative value.- Parameters:
sourceId- The source id of the source- Returns:
- The geometric distance in parsecs if it exists, -1 otherwise.
-
acceptDistance
protected boolean acceptDistance(double distance)
Checks whether to accept the distance- Parameters:
distance- Distance in parsecs- Returns:
- Whether to accept the distance or not
-
hasGeoDistance
protected boolean hasGeoDistance(long sourceId)
-
hasGeoDistances
protected boolean hasGeoDistances()
-
countLines
protected int countLines(com.badlogic.gdx.files.FileHandle f) throws java.io.IOException- Throws:
java.io.IOException
-
setMustLoadIds
public void setMustLoadIds(java.util.Set<java.lang.Long> ids)
Description copied from interface:IStarGroupDataProviderAdds a set with all the ids which will be loaded regardless of any other conditions (i.e. parallax error thresholds)- Specified by:
setMustLoadIdsin interfaceIStarGroupDataProvider- Parameters:
ids- The ids that must be loaded
-
countLines
protected int countLines(java.io.InputStream is) throws java.io.IOExceptionCounts the lines on this input stream- Parameters:
is- The input stream- Returns:
- The number of lines
- Throws:
java.io.IOException
-
dumpToDisk
protected void dumpToDisk(com.badlogic.gdx.utils.Array<StarGroup.StarBean> data, java.lang.String filename, java.lang.String format)
-
dumpToDiskBin
protected void dumpToDiskBin(com.badlogic.gdx.utils.Array<StarGroup.StarBean> data, java.lang.String filename, boolean serialized)
-
dumpToDiskCsv
protected void dumpToDiskCsv(com.badlogic.gdx.utils.Array<StarGroup.StarBean> data, java.lang.String filename)
-
setFileNumberCap
public void setFileNumberCap(int cap)
Description copied from interface:IParticleGroupDataProviderSets a cap on the number of files to load. Set to 0 or negative for unlimited- Specified by:
setFileNumberCapin interfaceIParticleGroupDataProvider- Parameters:
cap- The cap number
-
getColors
public com.badlogic.gdx.utils.LongMap<float[]> getColors()
- Specified by:
getColorsin interfaceIStarGroupDataProvider
-
setParallaxErrorFactorFaint
public void setParallaxErrorFactorFaint(double parallaxErrorFactor)
Description copied from interface:IStarGroupDataProviderThe loader will only load stars for which the parallax error is at most the percentage given here, in [0..1]. This applies to faint stars (gmag >= 13.1) More specifically, the following must be met:
pllx_err < pllx * pllxErrFactor- Specified by:
setParallaxErrorFactorFaintin interfaceIStarGroupDataProvider- Parameters:
parallaxErrorFactor- The percentage value of parallax errors with respect to parallax
-
setParallaxErrorFactorBright
public void setParallaxErrorFactorBright(double parallaxErrorFactor)
Description copied from interface:IStarGroupDataProviderThe loader will only load stars for which the parallax error is at most the percentage given here, in [0..1]. This applies to bright stars (gmag < 13.1) More specifically, the following must be met:
pllx_err < pllx * pllxErrFactor- Specified by:
setParallaxErrorFactorBrightin interfaceIStarGroupDataProvider- Parameters:
parallaxErrorFactor- The percentage value of parallax errors with respect to parallax
-
setAdaptiveParallax
public void setAdaptiveParallax(boolean adaptive)
Description copied from interface:IStarGroupDataProviderWhether to use an adaptive threshold, relaxing it for bright (appmag >= 13) stars to let more bright stars in.- Specified by:
setAdaptiveParallaxin interfaceIStarGroupDataProvider
-
setParallaxZeroPoint
public void setParallaxZeroPoint(double parallaxZeroPoint)
Description copied from interface:IStarGroupDataProviderSets the zero point of the parallax as an addition to the parallax values, in [mas]- Specified by:
setParallaxZeroPointin interfaceIStarGroupDataProvider- Parameters:
parallaxZeroPoint- The parallax zero point
-
setMagCorrections
public void setMagCorrections(boolean magCorrections)
Description copied from interface:IStarGroupDataProviderSets the flag to apply magnitude and color corrections for extinction and reddening- Specified by:
setMagCorrectionsin interfaceIStarGroupDataProvider- Parameters:
magCorrections- Whether to apply the corrections
-
getCountsPerMag
public long[] getCountsPerMag()
Description copied from interface:IStarGroupDataProviderGets the star counts per magnitude- Specified by:
getCountsPerMagin interfaceIStarGroupDataProvider
-
setGeoDistancesFile
public void setGeoDistancesFile(java.lang.String geoDistFile)
Description copied from interface:IStarGroupDataProviderSets the location of the geometric distances file or directory- Specified by:
setGeoDistancesFilein interfaceIStarGroupDataProvider- Parameters:
geoDistFile- File or directory with geometric distances per sourceId
-
setDistanceCap
public void setDistanceCap(double distCap)
Description copied from interface:IStarGroupDataProviderSets a distance cap. Stars beyond this distance will not be loaded- Specified by:
setDistanceCapin interfaceIStarGroupDataProvider- Parameters:
distCap- The distance cap, in parsecs
-
setRUWEFile
public void setRUWEFile(java.lang.String RUWEFile)
Description copied from interface:IStarGroupDataProviderSets the location of the gzipped RUWE file- Specified by:
setRUWEFilein interfaceIStarGroupDataProvider- Parameters:
RUWEFile- Gzipped file with RUWE values for each source id
-
setRUWECap
public void setRUWECap(double RUWE)
Description copied from interface:IStarGroupDataProviderSets the RUWE criteria. RUWE file must have been set- Specified by:
setRUWECapin interfaceIStarGroupDataProvider- Parameters:
RUWE- The criteria (usually 1.4)
-
-