Skip to content

Commit 05d7ffb

Browse files
committed
fixed getStaNames() to return 'UNDEFINED' if given staIndex is null (missing value case)
1 parent 563be81 commit 05d7ffb

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/main/java/fr/jmmc/oitools/model/OIAbstractData.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import fr.jmmc.oitools.meta.KeywordMeta;
2626
import fr.jmmc.oitools.meta.Types;
2727
import fr.jmmc.oitools.meta.Units;
28-
import static fr.jmmc.oitools.model.ModelBase.UNDEFINED_STRING;
2928
import static fr.jmmc.oitools.model.ModelBase.logger;
3029
import fr.jmmc.oitools.model.range.Range;
3130
import java.util.Arrays;
@@ -384,7 +383,7 @@ public String getStaName(final short staIndex) {
384383
*/
385384
public final String getStaNames(final short[] staIndexes) {
386385
if (staIndexes == null) {
387-
return UNDEFINED_STRING;
386+
return UNDEFINED;
388387
}
389388
final OIArray oiArray = getOiArray();
390389

@@ -442,10 +441,10 @@ public String getRealStaNames(final Map<String, StaNamesDir> usedStaNamesMap,
442441
logger.log(Level.WARNING, "getRealStaNames: bad staIndexesToSortedStaNamesDir: missing {0}", Arrays.toString(staIndexes));
443442
} else {
444443
// find the previous (real) baseline corresponding to the sorted StaNames (stable):
445-
return getRealStaNames(usedStaNamesMap, sortedStaNamesDir.getStaNames(), UNDEFINED_STRING);
444+
return getRealStaNames(usedStaNamesMap, sortedStaNamesDir.getStaNames(), UNDEFINED);
446445
}
447446
}
448-
return UNDEFINED_STRING;
447+
return UNDEFINED;
449448
}
450449

451450
/**

src/main/java/fr/jmmc/oitools/model/OIArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ public String getStaName(final short staIndex) {
529529
*/
530530
public String getStaNames(final short[] staIndexes) {
531531
if (staIndexes == null) {
532-
return UNDEFINED_STRING;
532+
return UNDEFINED;
533533
}
534534
// warning: identity hashcode so use carefully using distinct array instances:
535535
String label = staIndexesToStaNames.get(staIndexes);

src/main/java/fr/jmmc/oitools/model/OIFlux.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public OIFlux(final OIFitsFile oifitsFile, final OIFlux src) {
112112

113113
this.copyTable(src);
114114
}
115-
115+
116116
/* --- Keywords --- */
117117
/**
118118
* Get the value of CALSTAT keyword
@@ -247,6 +247,17 @@ protected double[][] getDerivedColumnAsDoubles(final String name) {
247247
@Override
248248
public void checkSyntax(final OIFitsChecker checker) {
249249
super.checkSyntax(checker);
250+
251+
/* TODO: add rules to validate (OIFits 2?)
252+
- If CALSTAT is C (Calibrated), the spectrum of the ob-
253+
ject does not depend on the telescope used: the table shall
254+
not contain ARRNAME and STA_INDEX.
255+
- If CALSTAT is U (Uncalibrated), ARRNAME and the
256+
STA_INDEX column must be present, and the flux stored in
257+
FLUXDATA is the flux measured on the telescope of array
258+
ARRNAME indicated by STA_INDEX. In this case, the table shall
259+
not contain FOV and FOVTYPE.
260+
*/
250261

251262
checkColumnError(checker, getFlag(), getFluxErr(), this, OIFitsConstants.COLUMN_FLUXERR);
252263

0 commit comments

Comments
 (0)