Skip to content

Commit

Permalink
0.30-2: Fixes to 2D maps and grids.
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Nov 8, 2019
1 parent 104f612 commit bc46f11
Show file tree
Hide file tree
Showing 6 changed files with 677 additions and 663 deletions.
6 changes: 6 additions & 0 deletions change.log
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
0.30-2

[BUG] {AngleFormat} parsing negative angles was incorrect. Fixed.

[FIX] {Grid2D} FITS header writing/parsing fixes.

[FIX] {CoordinateEpoch} Fix case mitmatch in comparison.

[FIX] {CoordinateEpoch} Parsing of FITS headers even if RADESYS is
not present.

[FIX] {AbstractMap2D1} Write WCSAXES=3 in FITS headers.

[TWEAK] {Observation2D+} deperated accumulate() call with weight only.
Instead call with gain and weight.

[TWEAK] {PrecessingCoordinates} Default to J2000 when parsing
coordinates with no epoch given in String or defined in parsing
object.
Expand Down
2 changes: 1 addition & 1 deletion src/jnum/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public final class Util {

public final static String version = "0.30-2";

public final static String revision = "devel.4";
public final static String revision = "";

public final static String copyright = "(c)2019 Attila Kovacs";

Expand Down
35 changes: 20 additions & 15 deletions src/jnum/data/cube2/Observation2D1.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@

public class Observation2D1 extends AbstractMap2D1<Observation2D> implements Observations<Data3D>, IndexedObservations<Index3D> {
private Class<? extends Number> weightType;


public Observation2D1(Class<? extends Number> dataType, Class<? extends Number> weightType, int flagType) {
super(dataType, flagType);
this.weightType = weightType;
Expand Down Expand Up @@ -142,8 +142,13 @@ public void setUnit(Unit u) {
};
}

public void accumulate(final Observation2D1 cube, final double weight) {
for(int k=sizeZ(); --k >= 0; ) getPlane(k).accumulate(cube.getPlane(k), weight);
public final void accumulate(final Observation2D1 cube) {
accumulate(cube, 1.0, 1.0);
}


public void accumulate(final Observation2D1 cube, final double gain, final double weight) {
for(int k=sizeZ(); --k >= 0; ) getPlane(k).accumulate(cube.getPlane(k), gain, weight);
}


Expand Down Expand Up @@ -220,7 +225,7 @@ public void setWeightAt(Index3D index, double value) {
public double exposureAt(Index3D index) {
return getPlane(index.k()).exposureAt(index.i(), index.j());
}


@Override
public Observation2D getAverageZ() {
Expand All @@ -235,7 +240,7 @@ public Observation2D getAverageZ(int fromZ, int toZ) {
if(tok < fromk) return null;

final Observation2D ave = getPlaneTemplate().copy(false);

new ForkZ<Void>(fromk, tok) {
@Override
protected void processPlane(int k) {
Expand All @@ -249,7 +254,7 @@ protected void processPlane(int k) {

return ave;
}

@Override
public Observation2D getMedianZ() {
return getMedianZ(0, sizeZ());
Expand Down Expand Up @@ -278,7 +283,7 @@ protected void process(int i, int j) {
for(int k=fromk; k < tok; k++) {
final Observation2D plane = getPlane(k);
if(!plane.isValid(i, j)) continue;

final WeightedPoint p = sorter[m++];
p.setValue(plane.get(i, j).doubleValue());
p.setWeight(plane.weightAt(i, j));
Expand All @@ -297,8 +302,8 @@ protected void process(int i, int j) {
}




@Override
public WeightedPoint getMean() { return getWeightedMean(getWeights()); }

Expand All @@ -309,18 +314,18 @@ protected void process(int i, int j) {
public final void memCorrect(final Values3D model, final double lambda) {
memCorrect(model, this.getNoise(), lambda);
}





@Override
public ArrayList<BasicHDU<?>> getHDUs(Class<? extends Number> dataType) throws FitsException {
ArrayList<BasicHDU<?>> hdus = super.getHDUs(dataType);

BasicHDU<?> hdu = getExposures().createHDU(dataType);
FitsToolkit.setName(hdu, "Exposure");
editHeader(hdu.getHeader());
hdus.add(hdu);

hdu = getNoise().createHDU(dataType);
editHeader(hdu.getHeader());
FitsToolkit.setName(hdu, "Noise");
Expand All @@ -334,5 +339,5 @@ public ArrayList<BasicHDU<?>> getHDUs(Class<? extends Number> dataType) throws F
return hdus;
}


}
Loading

0 comments on commit bc46f11

Please sign in to comment.