-
Notifications
You must be signed in to change notification settings - Fork 9
Time brightness #580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Time brightness #580
Changes from all commits
46591a3
1c526f7
5fce144
f5e4be7
d8738a9
7990dbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,21 +4,24 @@ | |
package lucuma.core.model | ||
|
||
import cats.Eq | ||
import cats.implicits._ | ||
import cats.data.NonEmptyMap | ||
import cats.implicits.* | ||
import coulomb.* | ||
import coulomb.ops.algebra.cats.all.given | ||
import coulomb.syntax.* | ||
import eu.timepit.refined.cats._ | ||
import eu.timepit.refined.cats.* | ||
import eu.timepit.refined.types.numeric.PosBigDecimal | ||
import lucuma.core.math.BrightnessUnits._ | ||
import lucuma.core.math.dimensional._ | ||
import lucuma.core.math.units._ | ||
import lucuma.core.math.BrightnessUnits.* | ||
import lucuma.core.math.dimensional.* | ||
import lucuma.core.math.units.* | ||
import monocle.Focus | ||
import monocle.Lens | ||
|
||
import java.time.Instant | ||
|
||
final case class EmissionLine[T]( | ||
lineWidth: Quantity[PosBigDecimal, KilometersPerSecond], | ||
lineFlux: Measure[PosBigDecimal] Of LineFlux[T] | ||
lineFlux: EmissionLine.LineFluxOverTime[T] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know anything about this unfortunately. It makes sense that the "line flux" would vary but are we sure that it does? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll verify, my input from science is that emission lines can also vary over time |
||
) { | ||
|
||
/** | ||
|
@@ -28,18 +31,20 @@ final case class EmissionLine[T]( | |
* `Integrated` or `Surface` | ||
*/ | ||
def to[T0](implicit conv: TagConverter[LineFlux[T], LineFlux[T0]]): EmissionLine[T0] = | ||
EmissionLine[T0](lineWidth, lineFlux.toTag[LineFlux[T0]]) | ||
EmissionLine[T0](lineWidth, lineFlux.map(_.toTag[LineFlux[T0]])) | ||
} | ||
|
||
object EmissionLine { | ||
implicit def eqEmissionLine[T]: Eq[EmissionLine[T]] = | ||
type LineFluxOverTime[T] = NonEmptyMap[Instant, Measure[PosBigDecimal] Of LineFlux[T]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wondered why we don't add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds like I just missed it when implementing emission lines. Let's add it. |
||
|
||
given eqEmissionLine[T]: Eq[EmissionLine[T]] = | ||
Eq.by(x => (x.lineWidth, x.lineFlux)) | ||
|
||
/** @group Optics */ | ||
def lineWidth[T]: Lens[EmissionLine[T], Quantity[PosBigDecimal, KilometersPerSecond]] = | ||
Focus[EmissionLine[T]](_.lineWidth) | ||
|
||
/** @group Optics */ | ||
def lineFlux[T]: Lens[EmissionLine[T], Measure[PosBigDecimal] Of LineFlux[T]] = | ||
def lineFlux[T]: Lens[EmissionLine[T], NonEmptyMap[Instant, Measure[PosBigDecimal] Of LineFlux[T]]] = | ||
Focus[EmissionLine[T]](_.lineFlux) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we could use the
BrightnessMeasure
alias here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good idea, to reduce confusion a bit