public static BasicHDU HDUFactory(Header hdr, Data d) throws FitsException {
if (d instanceof ImageData) {
return new ImageHDU(hdr, d);
} else if (d instanceof RandomGroupsData) {
return new RandomGroupsHDU(hdr, d);
} else if (d instanceof AsciiTable) {
return new AsciiTableHDU(hdr, d);
} else if (d instanceof BinaryTable) {
return new BinaryTableHDU(hdr, d);
} else if (d instanceof UndefinedData) {