Skip to content

Commit

Permalink
Merge pull request #883 from gemini-hlsw/no-resolution
Browse files Browse the repository at this point in the history
No resolution
  • Loading branch information
cquiroz authored Jan 28, 2025
2 parents d4eb7e4 + 6889b14 commit 7ddef25
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 33 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ jobs:
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-22.04'
run: sbt '++ ${{ matrix.scala }}' doc

- name: Validate GraphQL schema changes
if: github.event_name == 'pull_request'
uses: kamilkisiela/graphql-inspector@master
with:
schema: 'main:modules/service/src/main/resources/graphql/itc.graphql'
approve-label: expected-breaking-change

- name: Aggregate coverage reports
run: sbt '++ ${{ matrix.scala }}' coverageReport coverageAggregate

Expand Down
12 changes: 11 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Global / onChangedBuildSource := ReloadOnSourceChanges

ThisBuild / scalaVersion := "3.6.3"
ThisBuild / crossScalaVersions := Seq("3.6.3")
ThisBuild / tlBaseVersion := "0.25"
ThisBuild / tlBaseVersion := "0.26"
ThisBuild / tlCiReleaseBranches := Seq("master")
ThisBuild / scalacOptions ++= Seq("-Xmax-inlines", "50") // Hash derivation fails with default of 32

Expand Down Expand Up @@ -71,6 +71,16 @@ ThisBuild / watchOnTermination := { (action, cmd, times, state) =>
}
}

ThisBuild / githubWorkflowBuild +=
WorkflowStep.Use(
UseRef.Public("kamilkisiela", "graphql-inspector", "master"),
name = Some("Validate GraphQL schema changes"),
params = Map("schema" -> "main:modules/service/src/main/resources/graphql/itc.graphql",
"approve-label" -> "expected-breaking-change"
),
cond = Some("github.event_name == 'pull_request'")
)

// Basic model classes
lazy val model = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class BasicITCChecks extends Simulation {
results {
mode {
instrument
resolution
params {
... on GmosNITCParams {
grating
Expand Down Expand Up @@ -172,7 +171,6 @@ class BasicITCChecks extends Simulation {
results {
mode {
instrument
resolution
wavelength {
nanometers
}
Expand Down
8 changes: 1 addition & 7 deletions modules/service/src/main/resources/graphql/itc.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10216,7 +10216,7 @@ scalar Long

type Query {
versions: ItcVersions

# Given an instrument and a spectroscopy mode,
# return the integration time and the estimated S/N for the given targets.
spectroscopyIntegrationTime(
Expand Down Expand Up @@ -10247,9 +10247,6 @@ type ObservingModeSpectroscopy {
# Wavelength in appropriate units
wavelength: Wavelength!

# Resolution
resolution: BigDecimal!

# params
params: InstrumentITCParams!

Expand Down Expand Up @@ -10538,9 +10535,6 @@ type SpectroscopyMode implements ITCObservingMode {
# Wavelength in appropriate units
centralWavelength: Wavelength!

# Resolution
resolution: BigDecimal!

# params
params: InstrumentITCParams!

Expand Down
6 changes: 4 additions & 2 deletions modules/service/src/main/scala/lucuma/itc/ItcImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ object ItcImpl {
): F[TargetIntegrationTime] =
T.span("calculate-integration-time"):
observingMode match
case s @ ObservingMode.SpectroscopyMode(_, _, _) =>
case s @ (ObservingMode.SpectroscopyMode.GmosNorth(_, _, _, _, _, _) |
ObservingMode.SpectroscopyMode.GmosSouth(_, _, _, _, _, _)) =>
spectroscopyIntegrationTime(target, atWavelength, s, constraints, signalToNoise)
case i @ (
ObservingMode.ImagingMode.GmosNorth(_, _) |
Expand All @@ -64,7 +65,8 @@ object ItcImpl {
exposureCount: PosInt
): F[TargetGraphsCalcResult] =
observingMode match
case s @ ObservingMode.SpectroscopyMode(_, _, _) =>
case s @ (ObservingMode.SpectroscopyMode.GmosNorth(_, _, _, _, _, _) |
ObservingMode.SpectroscopyMode.GmosSouth(_, _, _, _, _, _)) =>
spectroscopyGraphs(
target,
atWavelength,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ object ObservingMode {

sealed trait SpectroscopyMode extends ObservingMode derives Hash {
def centralWavelength: Wavelength
def resolution: Rational
def coverage: Interval[Wavelength]
}

object SpectroscopyMode {
Expand All @@ -59,12 +57,13 @@ object ObservingMode {
case gs: GmosSouth => gs.asJson
}

def unapply(spectroscopyMode: SpectroscopyMode): (Wavelength, Rational, Interval[Wavelength]) =
(spectroscopyMode.centralWavelength, spectroscopyMode.resolution, spectroscopyMode.coverage)

sealed trait GmosSpectroscopy extends SpectroscopyMode derives Hash {
def isIfu: Boolean

def resolution: Rational

def coverage: Interval[Wavelength]

def analysisMethod: ItcObservationDetails.AnalysisMethod =
if (isIfu)
ItcObservationDetails.AnalysisMethod.Ifu.Single(
Expand Down Expand Up @@ -103,7 +102,6 @@ object ObservingMode {
given Encoder[GmosNorth] = a =>
Json.obj(
("instrument", Json.fromString(a.instrument.longName.toUpperCase.replace(" ", "_"))),
("resolution", Json.fromInt(a.resolution.toInt)),
("params", GmosNSpectroscopyParams(a.disperser, a.fpu, a.filter).asJson),
("centralWavelength", a.centralWavelength.asJson)
)
Expand Down Expand Up @@ -134,7 +132,6 @@ object ObservingMode {
given Encoder[GmosSouth] = a =>
Json.obj(
("instrument", Json.fromString(a.instrument.longName.toUpperCase.replace(" ", "_"))),
("resolution", Json.fromInt(a.resolution.toInt)),
("params", GmosSSpectroscopyParams(a.disperser, a.fpu, a.filter).asJson),
("centralWavelength", a.centralWavelength.asJson)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class GraphQLIntTimeErrorsSuite extends FailingCalculationSuite {
mode {
... on SpectroscopyMode {
instrument
resolution
params {
... on GmosNITCParams {
grating
Expand Down Expand Up @@ -108,7 +107,6 @@ class GraphQLIntTimeErrorsSuite extends FailingCalculationSuite {
"spectroscopyIntegrationTime" : {
"mode" : {
"instrument" : "GMOS_NORTH",
"resolution" : 970,
"params" : {
"grating" : "B1200_G5301"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class GraphQLSpectroscopyTimeEmissionLineSuite extends GraphQLEmissionLineSuite
mode {
... on SpectroscopyMode {
instrument
resolution
params {
... on GmosNITCParams {
grating
Expand Down Expand Up @@ -102,7 +101,6 @@ class GraphQLSpectroscopyTimeEmissionLineSuite extends GraphQLEmissionLineSuite
"spectroscopyIntegrationTime" : {
"mode" : {
"instrument" : "GMOS_NORTH",
"resolution" : 970,
"params": {
"grating": "B1200_G5301"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
mode {
... on SpectroscopyMode {
instrument
resolution
params {
... on GmosNITCParams {
grating
Expand Down Expand Up @@ -103,7 +102,6 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
"spectroscopyIntegrationTime" : {
"mode" : {
"instrument" : "GMOS_NORTH",
"resolution" : 970,
"params": {
"grating": "B1200_G5301"
},
Expand Down Expand Up @@ -190,7 +188,6 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
mode {
... on SpectroscopyMode {
instrument
resolution
params {
... on GmosSITCParams {
grating
Expand Down Expand Up @@ -218,7 +215,6 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
"spectroscopyIntegrationTime" : {
"mode" : {
"instrument" : "GMOS_SOUTH",
"resolution" : 970,
"params": {
"grating": "B1200_G5321"
},
Expand Down Expand Up @@ -399,7 +395,6 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
mode {
... on SpectroscopyMode {
instrument
resolution
params {
... on GmosNITCParams {
grating
Expand Down Expand Up @@ -428,7 +423,6 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
{
"mode" : {
"instrument" : "GMOS_NORTH",
"resolution" : 970,
"params": {
"grating": "B1200_G5301"
},
Expand Down Expand Up @@ -514,7 +508,6 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
mode {
... on SpectroscopyMode {
instrument
resolution
params {
... on GmosNITCParams {
grating
Expand Down Expand Up @@ -1302,7 +1295,7 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
radialVelocity: {
kilometersPerSecond: 1000
}
}
}
],
constraints: {
imageQuality: POINT_THREE,
Expand Down Expand Up @@ -1332,7 +1325,6 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
mode {
... on SpectroscopyMode {
instrument
resolution
params {
... on GmosNITCParams {
grating
Expand Down Expand Up @@ -1364,7 +1356,6 @@ class GraphQLSpectroscopyTimeSuite extends GraphQLSuite {
"spectroscopyIntegrationTime" : {
"mode" : {
"instrument" : "GMOS_NORTH",
"resolution" : 9703,
"params": {
"grating": "B1200_G5301"
},
Expand Down

0 comments on commit 7ddef25

Please sign in to comment.