}
public void fillHeader(Header h) throws FitsException {
if (dataArray.length <= 0 || dataArray[0].length != 2) {
throw new FitsException("Data not conformable to Random Groups");
}
int gcount = dataArray.length;
Object paraSamp = dataArray[0][0];
Object dataSamp = dataArray[0][1];
Class pbase = net.ivoa.util.ArrayFuncs.getBaseClass(paraSamp);
Class dbase = net.ivoa.util.ArrayFuncs.getBaseClass(dataSamp);
if (pbase != dbase) {
throw new FitsException(
"Data and parameters do not agree in type for random group");
}
int[] pdims = net.ivoa.util.ArrayFuncs.getDimensions(paraSamp);
int[] ddims = net.ivoa.util.ArrayFuncs.getDimensions(dataSamp);
if (pdims.length != 1) {
throw new FitsException(
"Parameters are not 1 d array for random groups");
}
// Got the information we need to build the header.
h.setSimple(true);
if (dbase == byte.class) {
h.setBitpix(8);
} else if (dbase == short.class) {
h.setBitpix(16);
} else if (dbase == char.class) {
h.setBitpix(-16);
} else if (dbase == int.class) {
h.setBitpix(32);
} else if (dbase == long.class) { // Non-standard
h.setBitpix(64);
} else if (dbase == float.class) {
h.setBitpix(-32);
} else if (dbase == double.class) {
h.setBitpix(-64);
} else {
throw new FitsException("Data type:" + dbase
+ " not supported for random groups");
}
h.setNaxes(ddims.length + 1);
h.addValue("NAXIS1", 0, "");