Skip to content

Commit

Permalink
REL-4624 Fix overhead calculations and suggested improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cquiroz committed Jan 24, 2025
1 parent 1d2d260 commit 9ecb994
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ organization in Global := "edu.gemini.ocs"
// true indicates a test release, and false indicates a production release
ocsVersion in ThisBuild := OcsVersion("2025A", true, 1, 1, 1)

pitVersion in ThisBuild := OcsVersion("2025B", true, 1, 1, 1)
pitVersion in ThisBuild := OcsVersion("2025B", true, 2, 1, 2)

// Bundles by default use the ocsVersion; this is overridden in bundles used only by the PIT
version in ThisBuild := ocsVersion.value.toOsgiVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ sealed abstract class Node[+I, C, S, +O](state: I) extends (S => Either[Node[O,

def title: String
def description: String
def warning: Option[String] = None
def toUIPage: UIPage[C, S]

def default: Option[S] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ object Igrins2 {
// The enumeration cannot include numbers thus we use a String as interemdiate here
class TelluricStarsOption(n: Igrins2NoddingOption) extends SingleSelectNode[Igrins2NoddingOption, String, Igrins2Blueprint](n) {
override val title = "Telluric calibration stars"
override val description = "Select the the number of telluric stars per observation. Each star uses 0.25 hr of partner time. Any change from the default must be justified in the technical description section."
override val description = "Select the the number of telluric stars per observation. Each star uses 0.25 hr of partner time."
override val warning = Some("Any change from the default must be justified in the technical description section.")
override val choices: List[String] = Igrins2TelluricStars.values.toList.map(Igrins2TelluricStars.show)
override def apply(m: String) = {
Right(Igrins2Blueprint(n, Igrins2TelluricStars.unsafeFromString(m)))
}

override def default: Option[String] = Some(Igrins2TelluricStars.show(Igrins2TelluricStars.Default))

override def unapply = {
case b: Igrins2Blueprint => Igrins2TelluricStars.show(b.telluricStars)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ object Overheads extends (BlueprintBase => Option[Overheads]) {
}

private case class IGRINS2Overheads(telluricTime: TimeAmount, telluricStars: Igrins2TelluricStars) extends Overheads {
private val VisitLength = TimeAmount(1.5, TimeUnit.HR)

override def calculate(progTime: TimeAmount): ObservationTimes = {
val progTimeHrs: Double = progTime.toHours.value
val nTelluric = telluricStars match {
case Igrins2TelluricStars.Default => (progTimeHrs / 1.5).toInt
case Igrins2TelluricStars.Default =>
math.ceil(progTimeHrs / VisitLength.toHours.value)
case Igrins2TelluricStars.TwoStar => 2
case Igrins2TelluricStars.OneStar => 1
case Igrins2TelluricStars.ZeroStar => 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ object OverheadsSpec {
),
(("igrins2", "default"), (
() => Igrins2Blueprint(Igrins2NoddingOption.NodToSky, Igrins2TelluricStars.Default),
obsTimes(1.7, 0.25))
obsTimes(1.7, 0.5))
),
(("igrins2", "two star"), (
() => Igrins2Blueprint(Igrins2NoddingOption.NodToSky, Igrins2TelluricStars.TwoStar),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ class BlueprintEditor private (initialState:UIState[_, _], editable:Boolean) ext
// Field values
Title.text = state.node.title
Description.text = state.node.description
state.node.warning.foreach{ v =>
Warning.visible = true
Warning.text = v
}
state match {
case s: SelectUIState[_, _] => addListView(s)
case s: TextUIState[_] => addTextView(s)
Expand All @@ -115,6 +119,7 @@ class BlueprintEditor private (initialState:UIState[_, _], editable:Boolean) ext
add(new BorderPanel {
add(Title, North)
add(Description, Center)
add(Warning, South)
}, North)

add(Instructions, South)
Expand All @@ -137,6 +142,19 @@ class BlueprintEditor private (initialState:UIState[_, _], editable:Boolean) ext
foreground = awt.Color.DARK_GRAY
}

// Warning is a text area with red
object Warning extends TextArea {
opaque = false
visible = false
editable = false
columns = 30
rows = 1
peer.setLineWrap(true)
peer.setWrapStyleWord(true)
border = swing.BorderFactory.createEmptyBorder(0, 4, 4, 4)
foreground = awt.Color.RED
}

// Our text entry is a text field
object TextEntry extends TextField("", 0) {
// Setup listeners when the user presses a key
Expand Down

0 comments on commit 9ecb994

Please sign in to comment.