public class Sample
extends java.lang.Object
Constructor and Description |
---|
Sample(java.lang.String name,
Suite suite)
Creates a new sample.
|
Modifier and Type | Method and Description |
---|---|
void |
addTreatmentStep(TreatmentStep treatmentStep)
Adds a treatment step to this sample.
|
void |
calculateFisher(Correction correction)
Calculates a Fisherian mean for the selected demagnetization steps.
|
void |
calculateMagSusJump()
Finds the first jump in magnetic susceptibility in the sample's
demagnetization data.
|
void |
calculateMdf()
Calculates the median destructive field using the visible treatmentSteps
points of this sample and stores the results within this sample.
|
void |
clearCalculations()
Clears all calculations for this sample (PCA, MDF, and great-circle fit)
and deselects all treatment steps.
|
void |
clearGreatCircle()
Clears great-circle fit for this sample.
|
void |
clearPca()
Clears PCA calculations for this sample.
|
void |
doPca(Correction correction)
Performs principal component analysis on a subset of the magnetic moment
data of this sample.
|
java.util.List<java.lang.String> |
exportFields(java.util.List<TreatmentParameter> fields)
Returns a specified subset of demagnetization treatmentSteps as strings.
|
void |
fitGreatCircle(Correction correction)
Fits a great circle to a subset of the magnetic moment vectors in this
sample.
|
void |
flip(MeasurementAxis axis)
Rotates all magnetic moment data (as stored in treatment steps) 180
degrees about the specified axis.
|
void |
fromString(java.lang.String string)
Sets some of sample's fields based on a supplied string.
|
Tensor |
getAms()
Returns this sample's AMS tensor.
|
java.util.List<Vec3> |
getCirclePoints(Correction correction)
Returns the magnetic moment vectors used for the current great-circle
fit.
|
CustomFields<java.lang.Boolean> |
getCustomFlags()
Returns this sample's custom flags.
|
CustomFields<java.lang.String> |
getCustomNotes()
Returns this sample's custom notes.
|
double |
getDepth()
Returns the depth of a this sample within a continuous long core,
where applicable.
|
Vec3 |
getDirection()
Returns the sample direction.
|
java.lang.String |
getDiscreteId()
Returns the discrete ID of this sample, as determined by the discrete ID
of the first TreatmentStep within the sample.
|
double |
getFirstGcStepLevel()
Returns the treatment level for the first point used in the great-circle
fit.
|
int |
getFirstRunNumber()
Returns the run number for the first treatment step in this sample.
|
FisherValues |
getFisherValues()
Returns the results of the last Fisher calculation.
|
double |
getFormAz()
Returns this sample's formation dip azimuth in degrees.
|
double |
getFormDip()
Returns this sample's formation dip angle in degrees.
|
double |
getFormStrike()
Returns this sample's formation strike in degrees.
|
GreatCircle |
getGreatCircle()
Returns the current great-circle fit for this sample, if any.
|
Vec3 |
getImportedDirection()
Returns the imported sample direction, if any.
|
double |
getLastGcStepLevel()
Returns the treatment level for the last point used in the great-circle
fit.
|
int |
getLastRunNumber()
Returns the run number for the last treatment step in this sample.
|
double |
getMagDev()
Returns the geomagnetic field declination at the sampling site.
|
double |
getMagSusJump()
Returns the results of the magnetic susceptibility jump calculation,
if it has been performed.
|
MedianDestructiveField |
getMdf()
Returns the results of the MDF calculation if it has been performed,
or
null if not. |
MeasurementType |
getMeasurementType()
Returns the measurement type of this sample (discrete or continuous).
|
java.lang.String |
getNameOrDepth()
Returns the sample identifier or depth.
|
double |
getNrm()
Returns the intensity of the sample's natural remanent magnetization
(NRM).
|
int |
getNumberOfSteps()
Returns the number of treatment steps within this sample.
|
PcaAnnotated |
getPcaAnnotated()
Returns the annotated results of the last PCA calculation.
|
PcaValues |
getPcaValues()
Returns the results of the last PCA calculation.
|
double |
getSampAz()
Returns this sample's dip azimuth in degrees.
|
double |
getSampDip()
Returns this sample's dip angle in degrees.
|
double |
getSampHade()
Returns this sample's hade in degrees.
|
java.util.List<TreatmentStep> |
getSelectedTreatmentSteps()
Returns all the selected treatment steps within this sample.
|
java.util.BitSet |
getSelectionBitSet()
Returns the selected treatment step indices as a bit set.
|
Site |
getSite()
Returns the site for this sample.
|
int |
getSlotNumber()
Returns the tray slot number for discrete samples.
|
Suite |
getSuite()
Returns the suite containing this sample.
|
double[] |
getTreatmentLevels()
Returns an array of the treatment levels in this sample.
|
TreatmentStep |
getTreatmentStepByIndex(int i)
Returns a specified treatment step from this sample.
|
TreatmentStep |
getTreatmentStepByLevel(double level)
Returns the first TreatmentStep in this Sample with the given treatment
level.
|
TreatmentStep |
getTreatmentStepByRunNumber(int maxRunNumber)
Returns the datum with the highest run number which is less than the
supplied run number.
|
TreatmentStep |
getTreatmentStepByTypeAndLevel(java.util.Set<TreatmentType> types,
double level)
Returns a TreatmentStep with a specified treatment type and level.
|
java.util.List<TreatmentStep> |
getTreatmentSteps()
Returns all the treatment steps within this sample.
|
java.util.List<TreatmentStep> |
getVisibleTreatmentSteps()
Returns all the visible (non-hidden) treatment steps within this sample.
|
boolean |
hasMagSusData()
Reports whether this sample has any magnetic susceptibility data.
|
boolean |
hasTreatmentSteps()
Reports whether this sample contains any treatmentSteps.
|
void |
hideAndDeselectSelectedPoints()
Sets all the selected treatment steps within this sample to be hidden, so
they will not be shown on plots.
|
void |
invertMoments()
Inverts all magnetic moment data.
|
boolean |
isEmptySlot()
Reports whether this sample is an empty slot on the measurement tray.
|
boolean |
isPcaAnchored()
Reports whether principal component analysis should be anchored for this
sample.
|
boolean |
isSelectionContiguous()
Returns
true if the selected treatment steps are contiguous. |
java.util.Set<TreatmentStep> |
mergeDuplicateTreatmentSteps()
Merges duplicate measurements within this Sample.
|
static void |
mergeSamples(java.util.List<Sample> samples)
Merges the demagnetization data of the supplied samples into the first
sample in the list.
|
void |
removeData(java.util.Collection<TreatmentStep> toRemove)
Remove specified treatmentSteps from this sample.
|
void |
rotateAroundZAxis(double angleDegrees)
Rotate all the magnetic moment vectors of this sample about the
z axis.
|
void |
selectAll()
Selects all the treatment steps within this sample.
|
void |
selectByTreatmentLevelRange(double min,
double max)
Selects all treatment steps within a certain treatment level range.
|
void |
selectNone()
De-selects all the treatment steps within this sample.
|
void |
selectVisible()
Selects all the visible (non-hidden) treatment steps within this sample.
|
void |
setAmsDirections(double i1,
double d1,
double i2,
double d2,
double i3,
double d3)
Sets the AMS data for the sample using the supplied principal directions.
|
void |
setAmsFromTensor(double k11,
double k22,
double k33,
double k12,
double k23,
double k13)
Sets the AMS data for this sample using the supplied tensor.
|
void |
setCorrections(double sampleAz,
double sampleDip,
double formAz,
double formDip,
double magDev)
Sets the orientation corrections for this sample's magnetic moment data.
|
void |
setDepth(java.lang.String newDepth)
Set the depth of this sample.
|
void |
setDiscreteId(java.lang.String discreteId)
Sets the discrete ID of this sample by setting the discrete IDs of its
TreatmentStep objects, if the sample has any
TreatmentStep objects. |
void |
setEmptySlot(boolean isEmptySlot)
Sets whether this sample is an empty slot on the measurement tray.
|
void |
setImportedDirection(Vec3 importedDirection)
Sets an imported direction for this sample.
|
void |
setNameOrDepth(java.lang.String newNameOrDepth)
Set the identifier of a sample.
|
void |
setPcaAnchored(boolean pcaAnchored)
Sets whether principal component analysis should be anchored for this
sample
|
void |
setSelectionBitSet(java.util.BitSet selection)
Sets the selection state of the sample's treatment steps from a supplied
bit set.
|
void |
setSite(Site site)
Sets the site for this sample.
|
void |
setValue(TreatmentParameter field,
java.lang.String value)
Sets the value of a specified field for each treatment step in the
sample.
|
java.util.List<java.lang.String> |
toStrings()
Returns a list of Strings representing data pertaining to this sample.
|
void |
touch()
Sets this sample's suite as "modified".
|
void |
truncateTreatmentSteps(int items)
Truncates the list of treatment steps to a specified number of
entries.
|
void |
unhideAllPoints()
Unhides all treatment steps within this sample.
|
void |
useSelectionForCircleFit()
Flags the selected treatment steps for use in the next great-circle fit.
|
void |
useSelectionForPca()
Flags all selected treatment steps for inclusion in principal component
analysis.
|
public Sample(java.lang.String name, Suite suite)
name
- sample identifier or numerical depthsuite
- the treatmentSteps suite of which this sample is a partpublic final void setDepth(java.lang.String newDepth)
newDepth
- a string representing a number to use as the
depth of this samplepublic void clearPca()
public void clearGreatCircle()
public void clearCalculations()
public Suite getSuite()
public void calculateMdf()
getMdf()
public MedianDestructiveField getMdf()
null
if not.null
if notcalculateMdf()
public double getDepth()
public double getNrm()
public void calculateMagSusJump()
getMagSusJump()
method. A jump is defined as an increase of at least 2.5 times in a
single treatment step. If there is no magnetic susceptibility data, or if
no jump occurs, a value of 0 will be stored.getMagSusJump()
public double getMagSusJump()
calculateMagSusJump()
public void flip(MeasurementAxis axis)
axis
- the axis about which to rotate the datapublic void invertMoments()
public void hideAndDeselectSelectedPoints()
TreatmentStep.isHidden()
public void selectAll()
TreatmentStep.setSelected(boolean)
public void selectVisible()
public void selectNone()
public void selectByTreatmentLevelRange(double min, double max)
min
- minimum treatment intensitymax
- maximum treatment intensityTreatmentStep.getTreatmentLevel()
public boolean hasTreatmentSteps()
true
if this sample contains any treatmentStepspublic java.util.List<TreatmentStep> getTreatmentSteps()
public java.util.List<TreatmentStep> getVisibleTreatmentSteps()
public java.util.List<TreatmentStep> getSelectedTreatmentSteps()
public boolean isSelectionContiguous()
true
if the selected treatment steps are contiguous. This
is the case if there are no unselected steps between the first selected
point and the last selected step.true
if the selected points are contiguouspublic int getNumberOfSteps()
public TreatmentStep getTreatmentStepByIndex(int i)
i
- the index of the requested treatment stepjava.lang.IndexOutOfBoundsException
- if no treatment step with the
selected index existspublic TreatmentStep getTreatmentStepByLevel(double level)
null
is returned. Any treatment levels differing by less than
1e-6 are considered equal.level
- a treatment levelpublic TreatmentStep getTreatmentStepByTypeAndLevel(java.util.Set<TreatmentType> types, double level)
null
is returned.
This method is mainly intended for use with ARM demagnetization data,
which can contain a mixture of "degauss" and "ARM" treatment types.types
- a set of treatment typeslevel
- a treatment levelpublic double[] getTreatmentLevels()
public void addTreatmentStep(TreatmentStep treatmentStep)
treatmentStep
- a treatment step to add to this samplepublic void setCorrections(double sampleAz, double sampleDip, double formAz, double formDip, double magDev)
sampleAz
- the sample dip azimuthsampleDip
- the sample dip angleformAz
- the formation dip azimuthformDip
- the formation dip anglemagDev
- the geomagnetic field declination at the sampling sitepublic boolean hasMagSusData()
true
if this sample has any magnetic susceptibility datapublic void useSelectionForPca()
public boolean isPcaAnchored()
true
if principal component analysis should be anchored
for this samplepublic void setPcaAnchored(boolean pcaAnchored)
pcaAnchored
- true
to anchor principal component analysis
for this samplepublic void doPca(Correction correction)
TreatmentStep.isInPca()
. The results are stored within
the sample and may be retrieved with getPcaAnnotated()
.correction
- the correction to apply to the magnetic moment
treatmentStepspublic PcaAnnotated getPcaAnnotated()
public PcaValues getPcaValues()
public FisherValues getFisherValues()
public Vec3 getImportedDirection()
setImportedDirection(net.talvi.puffinplot.data.Vec3)
or fromString(java.lang.String)
.
If no imported direction has been set, null is returned.public void setImportedDirection(Vec3 importedDirection)
setImportedDirection(net.talvi.puffinplot.data.Vec3)
and is
exported by toStrings()
.importedDirection
- the imported direction to setpublic Vec3 getDirection()
null
is returned.public void useSelectionForCircleFit()
public GreatCircle getGreatCircle()
public java.util.List<Vec3> getCirclePoints(Correction correction)
correction
- the correction to apply to the magnetic moment vectorspublic void fitGreatCircle(Correction correction)
TreatmentStep.isOnCircle()
is true for it.correction
- the correction to apply to the magnetic moment
treatmentStepspublic double getFirstGcStepLevel()
public double getLastGcStepLevel()
public MeasurementType getMeasurementType()
public java.lang.String getNameOrDepth()
public void setNameOrDepth(java.lang.String newNameOrDepth)
newNameOrDepth
- public int getSlotNumber()
public int getFirstRunNumber()
public int getLastRunNumber()
public TreatmentStep getTreatmentStepByRunNumber(int maxRunNumber)
maxRunNumber
- the run number against which to compare run numbers
associated with this samplepublic boolean isEmptySlot()
true
if this sample is an empty slot on the measurement
traypublic void setEmptySlot(boolean isEmptySlot)
isEmptySlot
- true
to declare this sample as an empty slot
on the measurement traypublic void unhideAllPoints()
public java.util.BitSet getSelectionBitSet()
setSelectionBitSet(java.util.BitSet)
public void setSelectionBitSet(java.util.BitSet selection)
selection
- a template for the selection state of the treatment
stepsgetSelectionBitSet()
public Site getSite()
public void setSite(Site site)
site
- the site for this samplepublic void setAmsFromTensor(double k11, double k22, double k33, double k12, double k23, double k13)
k11
- tensor value (1,1)k22
- tensor value (2,2)k33
- tensor value (3,3)k12
- tensor value (1,2)k23
- tensor value (2,3)k13
- tensor value (1,3)public void setAmsDirections(double i1, double d1, double i2, double d2, double i3, double d3)
i1
- inclination of principal axis 1d1
- declination of principal axis 1i2
- inclination of principal axis 2d2
- declination of principal axis 2i3
- inclination of principal axis 3d3
- declination of principal axis 3public Tensor getAms()
null
if none has been setpublic java.util.List<java.lang.String> exportFields(java.util.List<TreatmentParameter> fields)
TreatmentParameter
s and returns a
list of strings. Each string in the list represents one
TreatmentStep
in this sample, and consists of a concatenation of
string representations of the requested fields (in the corresponding
order), delimited by tab characters.fields
- the fields to exportTreatmentStep
in this samplepublic java.util.List<java.lang.String> toStrings()
public void fromString(java.lang.String string)
toStrings()
is a valid input for this method.string
- a string specifying some of the sample's fieldspublic CustomFields<java.lang.Boolean> getCustomFlags()
public CustomFields<java.lang.String> getCustomNotes()
public double getSampAz()
public double getSampDip()
public double getSampHade()
public double getFormAz()
public double getFormStrike()
public double getFormDip()
public double getMagDev()
public void setValue(TreatmentParameter field, java.lang.String value)
field
- the field to setvalue
- the value to which to set the specified fieldpublic void touch()
public void calculateFisher(Correction correction)
correction
- the correction to apply to the moment measurementspublic void truncateTreatmentSteps(int items)
items
- the number of treatment steps to retain; the first
items
steps will be kept, and the rest deleted.public void rotateAroundZAxis(double angleDegrees)
angleDegrees
- the angle (in degrees) by which to rotate the
magnetic momentspublic java.lang.String getDiscreteId()
null
.null
public void setDiscreteId(java.lang.String discreteId)
TreatmentStep
objects, if the sample has any
TreatmentStep
objects. If the sample has no TreatmentStep
objects, IllegalStateException
will be thrown. (This limitation
is a historical artefact which will be removed when PuffinPlot's
data model is revised to store the discrete ID within the
Sample
object itself.)discreteId
- the discrete ID to setpublic void removeData(java.util.Collection<TreatmentStep> toRemove)
TreatmentStep
in the collection passed to this method will be
removed. Any TreatmentStep
in the collection which is not in this
Sample will be ignored.toRemove
- the treatmentSteps to removepublic java.util.Set<TreatmentStep> mergeDuplicateTreatmentSteps()
public static void mergeSamples(java.util.List<Sample> samples)
samples
-