assertEquals(strCol[i], s1[i].trim());
}
f = new Fits("at1.fits");
AsciiTableHDU hdu = (AsciiTableHDU) f.getHDU(1);
AsciiTable data = (AsciiTable) hdu.getData();
for (int i = 0; i < 10; i += 1) {
Object[] row = data.getRow(i);
float[] f2 = (float[]) row[0];
String[] s2 = (String[]) row[4];
f1 = (float[]) data.getElement(i, 0);
s1 = (String[]) data.getElement(i, 4);
assertEquals(f1[0], f2[0], 0.0f);
assertEquals(s1[0], s2[0]);
}
f1 = (float[]) data.getColumn(0);
s1 = (String[]) data.getColumn(4);
for (int i = 0; i < 10; i += 1) {
assertEquals(realCol[i], f1[i], 0.0f);
assertEquals(s1[i].trim(), strCol[i]);
}
for (int i = 0; i < 10; i += 1) {
Object[] row = data.getRow(i);
f1 = (float[]) row[0];
s1 = (String[]) row[4];
float[] f2 = (float[]) data.getElement(i, 0);
String[] s2 = (String[]) data.getElement(i, 4);
assertEquals(f1[0], f2[0], 0.0f);
assertEquals(s1[0], s2[0]);
}
f1 = (float[]) data.getColumn(0);
float[] f2 = (float[]) f1.clone();
for (int i = 0; i < f2.length; i += 1) {
f2[i] = 2 * f2[i];
}
data.setColumn(0, f2);
f1 = new float[]{3.14159f};
data.setElement(3, 0, f1);
hdu.setNullString(0, "**INVALID**");
data.setNull(5, 0, true);
data.setNull(6, 0, true);
Object[] row = new Object[5];
row[0] = new float[]{6.28f};
row[1] = new int[]{22};
row[2] = new long[]{0};
row[3] = new double[]{-3};
row[4] = new String[]{"A string"};
data.setRow(4, row);
// Rewrite (for grins rewrite header second)
hdu.getHeader().rewrite();
BufferedFile bf = new BufferedFile("at1.fits", "rw");
f.write(bf);
bf.flush();