Skip to content

Commit

Permalink
Merge pull request #2170 from gemini-hlsw/REL-4313
Browse files Browse the repository at this point in the history
REL-4313 Indicate if GHOST is using P2
  • Loading branch information
cquiroz authored May 18, 2023
2 parents df3e10e + 423fa35 commit bee1af5
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package edu.gemini.wdba.tcc;

import edu.gemini.spModel.gemini.ghost.Ghost;
import edu.gemini.spModel.guide.GuideProbe;
import edu.gemini.spModel.target.obsComp.PwfsGuideProbe;

import java.util.Objects;

Expand Down Expand Up @@ -36,9 +38,19 @@ public String getPositionAngle() {
return inst.getPosAngleDegreesStr();
}

private boolean usesProbe(GuideProbe gp) {
return oe.containsTargets(gp);
}

private boolean usesP2() {
return usesProbe(PwfsGuideProbe.pwfs2);
}

@Override
public String getTccConfigInstrument() {
final String result;

final String usesP2 = usesP2() ? "_P2" : "";
switch (oe.getTargetEnvironment().getAsterism().asterismType()) {

case GhostSingleTarget:
Expand All @@ -65,7 +77,7 @@ public String getTccConfigInstrument() {
default:
result = "GHOST";
}
return result;
return result + usesP2;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ package edu.gemini.wdba.tcc;
import edu.gemini.pot.sp.SPComponentType
import edu.gemini.spModel.gemini.ghost.Ghost
import edu.gemini.spModel.gemini.ghost.GhostAsterism
import edu.gemini.spModel.guide.GuideProbe
import edu.gemini.spModel.target.SPCoordinates
import edu.gemini.spModel.target.env.TargetEnvironment
import edu.gemini.spModel.target.obsComp.PwfsGuideProbe
import org.junit.Test;

/**
Expand All @@ -19,38 +21,80 @@ class GhostSupportTest extends InstrumentSupportTestBase[Ghost](SPComponentType.
private val emptySky = new SPCoordinates()

@Test
def testSingleTarget() {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.SingleTarget(emptyTarget, None)));
verifyInstrumentConfig(getSouthResults, "GHOST_SINGLE_TARGET");
def testSingleTarget(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.SingleTarget(emptyTarget, None)))
verifyInstrumentConfig(getSouthResults, "GHOST_SINGLE_TARGET")
}

@Test
def testDualTarget() {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.DualTarget(emptyTarget, emptyTarget, None)));
verifyInstrumentConfig(getSouthResults, "GHOST_DUAL_TARGET");
def testDualTarget(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.DualTarget(emptyTarget, emptyTarget, None)))
verifyInstrumentConfig(getSouthResults, "GHOST_DUAL_TARGET")
}

@Test
def testTargetPlusSky() {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.TargetPlusSky(emptyTarget, emptySky, None)));
verifyInstrumentConfig(getSouthResults, "GHOST_TARGET_PLUS_SKY");
def testTargetPlusSky(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.TargetPlusSky(emptyTarget, emptySky, None)))
verifyInstrumentConfig(getSouthResults, "GHOST_TARGET_PLUS_SKY")
}

@Test
def testSkyPlusTarget() {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.SkyPlusTarget(emptySky, emptyTarget, None)));
verifyInstrumentConfig(getSouthResults, "GHOST_SKY_PLUS_TARGET");
def testSkyPlusTarget(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.SkyPlusTarget(emptySky, emptyTarget, None)))
verifyInstrumentConfig(getSouthResults, "GHOST_SKY_PLUS_TARGET")
}

@Test
def testHighResolution() {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.HighResolutionTargetPlusSky(emptyTarget, emptySky, GhostAsterism.PrvMode.PrvOff, None)));
verifyInstrumentConfig(getSouthResults, "GHOST_HIGH_RESOLUTION");
def testHighResolution(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.HighResolutionTargetPlusSky(emptyTarget, emptySky, GhostAsterism.PrvMode.PrvOff, None)))
verifyInstrumentConfig(getSouthResults, "GHOST_HIGH_RESOLUTION")
}

@Test
def testHighResolutionPrv() {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.HighResolutionTargetPlusSky(emptyTarget, emptySky, GhostAsterism.PrvMode.PrvOn, None)));
verifyInstrumentConfig(getSouthResults, "GHOST_HIGH_RESOLUTION");
def testHighResolutionPrv(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.HighResolutionTargetPlusSky(emptyTarget, emptySky, GhostAsterism.PrvMode.PrvOn, None)))
verifyInstrumentConfig(getSouthResults, "GHOST_HIGH_RESOLUTION")
}

@Test
def testSingleTargetP2(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.SingleTarget(emptyTarget, None)))
addGuideStar(PwfsGuideProbe.pwfs2)
verifyInstrumentConfig(getSouthResults, "GHOST_SINGLE_TARGET_P2")
}

@Test
def testDualTargetP2(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.DualTarget(emptyTarget, emptyTarget, None)))
addGuideStar(PwfsGuideProbe.pwfs2)
verifyInstrumentConfig(getSouthResults, "GHOST_DUAL_TARGET_P2")
}

@Test
def testTargetPlusSkyP2(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.TargetPlusSky(emptyTarget, emptySky, None)))
addGuideStar(PwfsGuideProbe.pwfs2)
verifyInstrumentConfig(getSouthResults, "GHOST_TARGET_PLUS_SKY_P2")
}

@Test
def testSkyPlusTargetP2(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.SkyPlusTarget(emptySky, emptyTarget, None)))
addGuideStar(PwfsGuideProbe.pwfs2)
verifyInstrumentConfig(getSouthResults, "GHOST_SKY_PLUS_TARGET_P2")
}

@Test
def testHighResolutionP2(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.HighResolutionTargetPlusSky(emptyTarget, emptySky, GhostAsterism.PrvMode.PrvOff, None)))
addGuideStar(PwfsGuideProbe.pwfs2)
verifyInstrumentConfig(getSouthResults, "GHOST_HIGH_RESOLUTION_P2")
}

@Test
def testHighResolutionPrvP2(): Unit = {
setTargetEnvironment(TargetEnvironment.create(GhostAsterism.HighResolutionTargetPlusSky(emptyTarget, emptySky, GhostAsterism.PrvMode.PrvOn, None)))
addGuideStar(PwfsGuideProbe.pwfs2)
verifyInstrumentConfig(getSouthResults, "GHOST_HIGH_RESOLUTION_P2")
}
}

0 comments on commit bee1af5

Please sign in to comment.