Skip to content

Commit

Permalink
Remove the fallbackAirmass concept
Browse files Browse the repository at this point in the history
  • Loading branch information
cquiroz committed Aug 5, 2024
1 parent b745119 commit a876ddb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ def parallacticAngle(place: Place, tracking: ObjectTracking, vizTime: Instant):
* @param tracking object coordinates and motion for the object
* @param vizTime the time at which the observation is scheduled to start
* @param duration the duration of the observation
* @param fallbackAirmass the airmass to use when the airmass is not available
* @param samplingRate the rate at which to sample the parallactic angle
*/
def averageParallacticAngle(
place: Place,
tracking: ObjectTracking,
vizTime: Instant,
duration: TimeSpan,
fallbackAirmass: Double = 0.0,
samplingRate: TimeSpan = TimeSpan.unsafeFromMicroseconds(30.seconds.toMicros)
): Option[Angle] = {
val defined: TimeRange = (vizTime.toEpochMilli(), vizTime.plus(duration.toDuration).toEpochMilli())
Expand Down Expand Up @@ -101,7 +99,7 @@ def averageParallacticAngle(
angle + normalizingFactor
} else angle

val weight = if (airmass <= 0.0) fallbackAirmass else math.pow(airmass - 1.0, 1.3)
val weight = if (airmass <= 0.0) 0.0 else math.pow(airmass - 1.0, 1.3)
(normalizedAngle * weight, weight)
}
.unzip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

package lucuma.core.math.skycalc

import cats.syntax.all.*
import com.fortysevendeg.scalacheck.datetime.GenDateTime.genDateTimeWithinRange
import com.fortysevendeg.scalacheck.datetime.instances.jdk8.*
import edu.gemini.skycalc.ImprovedSkyCalcTest
Expand Down Expand Up @@ -38,7 +37,7 @@ final class ImprovedSkyCalcSuiteJVM extends ScalaCheckSuite {
)
private val zdtRange = Duration.ofDays(Period.ofYears(1000).getDays.toLong)

test("average parallactic angle no fallback") {
test("average parallactic angle no visible target") {
val when = Instant.parse("2024-08-02T21:00:00Z")
val coord = Coordinates.fromHmsDms.getOption("00:15:21.550600 +28:35:13.831766").get
assert(averageParallacticAngle(
Expand All @@ -47,20 +46,6 @@ final class ImprovedSkyCalcSuiteJVM extends ScalaCheckSuite {
when,
TimeSpan.fromHours(1).get).isEmpty
)

}

test("average parallactic angle with fallback") {
val when = Instant.parse("2024-08-02T21:00:00Z")
val coord = Coordinates.fromHmsDms.getOption("00:15:21.550600 +28:35:13.831766").get
assert(averageParallacticAngle(
Site.GN.place,
ObjectTracking.constant(coord),
when,
TimeSpan.fromHours(1).get,
100).exists(_ === Angle.fromMicroarcseconds(216766799171L))
)

}

test("Arbitrary sky calculations".tag(ScalaCheckFlaky)) {
Expand Down

0 comments on commit a876ddb

Please sign in to comment.