From 016fff3bbf045b1cbcc8ba18eabb3b89b9038392 Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 13:04:53 -0300 Subject: [PATCH 01/13] core 0.64.0 --- build.sbt | 2 +- .../test/scala/lucuma/itc/LegacyITCSimulation.scala | 13 +++++++------ .../src/main/scala/lucuma/itc/legacy/encoders.scala | 6 +++--- .../scala/lucuma/itc/search/ObservingMode.scala | 13 +++++++------ .../lucuma/itc/search/syntax/GmosNorthFilter.scala | 13 +++++++------ .../lucuma/itc/search/syntax/GmosSouthFilter.scala | 12 ++++++------ .../main/scala/lucuma/itc/service/ItcPartials.scala | 5 +++-- 7 files changed, 34 insertions(+), 30 deletions(-) diff --git a/build.sbt b/build.sbt index 849bf100..0c41467d 100644 --- a/build.sbt +++ b/build.sbt @@ -12,7 +12,7 @@ val http4sVersion = "0.23.18" val http4sJdkHttpClientVersion = "0.9.0" val fs2Version = "3.6.1" val kindProjectorVersion = "0.13.2" -val lucumaCoreVersion = "0.63.2" +val lucumaCoreVersion = "0.67.0" val lucumaRefinedVersion = "0.1.1" val slf4jVersion = "2.0.6" val log4catsVersion = "2.5.0" diff --git a/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala b/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala index 3277dac3..73d97e23 100644 --- a/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala +++ b/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala @@ -16,6 +16,7 @@ import io.gatling.http.funspec.GatlingHttpFunSpec import lucuma.core.enums.* import lucuma.core.math.Angle import lucuma.core.math.BrightnessUnits.* +import lucuma.core.math.BrightnessValue import lucuma.core.math.Redshift import lucuma.core.math.Wavelength import lucuma.core.math.dimensional.* @@ -49,7 +50,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { SpectralDefinition.BandNormalized( UnnormalizedSED.StellarLibrary(StellarLibrarySpectrum.A0V).some, SortedMap( - Band.R -> BigDecimal(5).withUnit[VegaMagnitude].toMeasureTagged + Band.R -> BrightnessValue(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged ) ) ), @@ -377,7 +378,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { .body( StringBody( bodyIntMagUnits( - f.withValueTagged(BigDecimal(5)) + f.withValueTagged(BrightnessValue(BigDecimal(5))) ).asJson.noSpaces ) ) @@ -413,7 +414,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { .body( StringBody( bodySurfaceMagUnits( - f.withValueTagged(BigDecimal(5)) + f.withValueTagged(BrightnessValue(BigDecimal(5))) ).asJson.noSpaces ) ) @@ -450,7 +451,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { .body( StringBody( bodyIntGaussianMagUnits( - f.withValueTagged(BigDecimal(5)) + f.withValueTagged(BrightnessValue(BigDecimal(5))) ).asJson.noSpaces ) ) @@ -465,7 +466,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { SpectralDefinition.BandNormalized( UnnormalizedSED.PowerLaw(c).some, SortedMap( - Band.R -> BigDecimal(5).withUnit[VegaMagnitude].toMeasureTagged + Band.R -> BrightnessValue(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged ) ) ) @@ -500,7 +501,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { SpectralDefinition.BandNormalized( UnnormalizedSED.BlackBody(c.withUnit[Kelvin]).some, SortedMap( - Band.R -> BigDecimal(5).withUnit[VegaMagnitude].toMeasureTagged + Band.R -> BrightnessValue(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged ) ) ) diff --git a/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala b/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala index c48da09a..b5c2cba2 100644 --- a/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala +++ b/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala @@ -264,21 +264,21 @@ given Encoder[ItcSourceDefinition] = (s: ItcSourceDefinition) => if brightnesses.contains(s.normBand) => brightnesses .get(s.normBand) - .map(_.value.toDouble) + .map(_.value.value.toDouble) .flatMap(Json.fromDouble) .getOrElse(Json.Null) case SourceProfile.Uniform(SpectralDefinition.BandNormalized(_, brightnesses)) if brightnesses.contains(s.normBand) => brightnesses .get(s.normBand) - .map(_.value.toDouble) + .map(_.value.value.toDouble) .flatMap(Json.fromDouble) .getOrElse(Json.Null) case SourceProfile.Gaussian(_, SpectralDefinition.BandNormalized(_, brightnesses)) if brightnesses.contains(s.normBand) => brightnesses .get(s.normBand) - .map(_.value.toDouble) + .map(_.value.value.toDouble) .flatMap(Json.fromDouble) .getOrElse(Json.Null) // FIXME: Handle emission line diff --git a/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala b/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala index 1812ed94..08ea7b21 100644 --- a/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala +++ b/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala @@ -9,13 +9,14 @@ import io.circe.* import io.circe.syntax.* import lucuma.core.enums._ import lucuma.core.math.Angle -import lucuma.core.math.Coverage +import lucuma.core.math.BoundedInterval import lucuma.core.math.Wavelength import lucuma.itc.GmosNITCParams import lucuma.itc.GmosSITCParams import lucuma.itc.encoders.given import lucuma.itc.search.hashes.given import lucuma.itc.search.syntax.* +import spire.math.Interval import spire.math.Rational case class GmosNorthFpuParam( @@ -42,7 +43,7 @@ object ObservingMode { sealed trait Spectroscopy extends ObservingMode derives Hash { def λ: Wavelength def resolution: Rational - def coverage: Coverage + def coverage: Interval[Wavelength] } object Spectroscopy { @@ -81,8 +82,8 @@ object ObservingMode { def resolution: Rational = disperser.resolution(λ, fpu.effectiveSlitWidth) - def coverage: Coverage = - filter.foldLeft(disperser.coverage(λ))(_ ⋂ _.coverageGN) + def coverage: Interval[Wavelength] = + filter.foldLeft(disperser.coverage(λ).toInterval)(_ intersect _.coverageGN) } object GmosNorth: @@ -109,8 +110,8 @@ object ObservingMode { def resolution: Rational = disperser.resolution(λ, fpu.effectiveSlitWidth) - def coverage: Coverage = - filter.foldLeft(disperser.coverage(λ))(_ ⋂ _.coverageGS) + def coverage: Interval[Wavelength] = + filter.foldLeft(disperser.coverage(λ).toInterval)(_ intersect _.coverageGS) } object GmosSouth: diff --git a/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosNorthFilter.scala b/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosNorthFilter.scala index f3fba756..64f64b91 100644 --- a/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosNorthFilter.scala +++ b/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosNorthFilter.scala @@ -6,17 +6,18 @@ package lucuma.itc.search.syntax import cats.implicits._ import lucuma.core.enums.GmosNorthFilter import lucuma.core.enums.GmosNorthFilter._ -import lucuma.core.math.Coverage +import lucuma.core.math.BoundedInterval import lucuma.core.math.Wavelength +import spire.math.Interval extension (self: GmosNorthFilter) // see http://www.gemini.edu/node/10621 - def coverageGN: Coverage = + def coverageGN: Interval[Wavelength] = import Wavelength.intPicometers - def cov(a: Int, b: Int = Int.MaxValue): Coverage = + def cov(a: Int, b: Int = Int.MaxValue): Interval[Wavelength] = (intPicometers.getOption(a), intPicometers.getOption(b)) - .mapN(Coverage.apply) + .mapN(Interval.closed) .getOrElse(sys.error("Invalid constant coverage.")) self match @@ -50,8 +51,8 @@ extension (self: GmosNorthFilter) // These are only used for engineering and will never be selected by search algorithm, but // we still need to handle them. For now we'll just pretend they have no coverage at all. - case HartmannA_RPrime => Coverage.Empty - case HartmannB_RPrime => Coverage.Empty + case HartmannA_RPrime => Interval.empty + case HartmannB_RPrime => Interval.empty // Allowed Filter Combinations case GPrime_GG455 => cov(460000, 552000) diff --git a/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosSouthFilter.scala b/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosSouthFilter.scala index 024d2d40..92c62c22 100644 --- a/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosSouthFilter.scala +++ b/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosSouthFilter.scala @@ -6,17 +6,17 @@ package lucuma.itc.search.syntax import cats.implicits._ import lucuma.core.enums.GmosSouthFilter import lucuma.core.enums.GmosSouthFilter._ -import lucuma.core.math.Coverage import lucuma.core.math.Wavelength +import spire.math.Interval extension (self: GmosSouthFilter) // see http://www.gemini.edu/node/10621 - def coverageGS: Coverage = + def coverageGS: Interval[Wavelength] = import Wavelength.intPicometers - def cov(a: Int, b: Int = Int.MaxValue): Coverage = + def cov(a: Int, b: Int = Int.MaxValue): Interval[Wavelength] = (intPicometers.getOption(a), intPicometers.getOption(b)) - .mapN(Coverage.apply) + .mapN(Interval.closed) .getOrElse(sys.error("Invalid constant coverage.")) self match @@ -49,8 +49,8 @@ extension (self: GmosSouthFilter) // These are only used for engineering and will never be selected by search algorithm, but // we still need to handle them. For now we'll just pretend they have no coverage at all. - case HartmannA_RPrime => Coverage.Empty - case HartmannB_RPrime => Coverage.Empty + case HartmannA_RPrime => Interval.empty + case HartmannB_RPrime => Interval.empty // Allowed Filter Combinations case GPrime_GG455 => cov(460000, 552000) diff --git a/modules/service/src/main/scala/lucuma/itc/service/ItcPartials.scala b/modules/service/src/main/scala/lucuma/itc/service/ItcPartials.scala index d86df4d6..929d52bc 100644 --- a/modules/service/src/main/scala/lucuma/itc/service/ItcPartials.scala +++ b/modules/service/src/main/scala/lucuma/itc/service/ItcPartials.scala @@ -30,6 +30,7 @@ import io.circe.Json import lucuma.core.enums.* import lucuma.core.math.Angle import lucuma.core.math.BrightnessUnits.* +import lucuma.core.math.BrightnessValue import lucuma.core.math.RadialVelocity import lucuma.core.math.Wavelength import lucuma.core.math.dimensional.Units.* @@ -230,10 +231,10 @@ trait GracklePartials extends GrackleParsers: val units = unitsItems.get(u) (band, value, units) .mapN { (b, v, u) => - b -> u.withValueTagged(v) + b -> u.withValueTagged(BrightnessValue(v)) } .toRightIorNec("Invalid brightness") - case e => s"Invalid brighness entry $e".leftIorNec + case e => s"Invalid brightness entry $e".leftIorNec } .sequence .map(v => SortedMap(v: _*)) From a1a54472541dcfd4264ed7e22b45ffcd5fd2644b Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 13:30:59 -0300 Subject: [PATCH 02/13] 0.65.0 --- .build.sbt.swp | Bin 0 -> 20480 bytes .../scala/lucuma/itc/LegacyITCSimulation.scala | 12 ++++++------ .../itc/client/json/BandNormalizedJson.scala | 4 ++-- .../main/scala/lucuma/itc/legacy/encoders.scala | 6 +++--- .../scala/lucuma/itc/service/ItcPartials.scala | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 .build.sbt.swp diff --git a/.build.sbt.swp b/.build.sbt.swp new file mode 100644 index 0000000000000000000000000000000000000000..1e908bb4d25e19d90bfb5d1dbf76a52e82170fe5 GIT binary patch literal 20480 zcmeHPYit}>6&{-M=rfcGp$dLnwl!KO-dR6Vnl!j2andFsj$PXcf~qp(*}L|{voqV7 zStm{?NbMg$l=A40@(>CV2vjOiX(h^|s328B1)++9K>VlxRiaSwgFi@p0pB_I&U0t& z)GeS&v(mSZJLjHz?zyk?xZ0)B6Njh89&^;d>#c_Iy~V%Tb1!_uxc_U05uUQ#RTsSpZvYSgi$8DM6Qq*6iDycM3 zY2dZcKrd=Hc3);pjF0hBzq^FsZ5T7R|+&$sE{rv7}W@Ld0_J}M1V8mKf-X`s?TrGZKV zl?EyeR2rx>P-&pjK&65Ig9faYVY~(HK1>cj^8c~_|L5(7@h9N>z};bj|&s=U8 zKLqXpY+w(t9eCz4!}tMk4E;WotfzJcWz$9=b@a!dq@e|-)zyWRq-VQu> zv0?lacntU?@Co2HpaEP6Jav&_{2KT&@Fn0Za0YOI4*{10mjagnzd`4EKnMgt6SxYv z2zc?$hVggcao`KU60jE-1$F?>zsWGZ3v>Y&I0-nw9Pm!yUvGqtfX9JHfUg2~07rlW z!25w4fo;HZ2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Q8i9YSWjkaId;c9QR&q{hi+>}1cR3~txaw^)>PoSk7uCo7ijGD(+B-z1`Kz^jA} za~sHu?6(2#qU8V&`S5$oAd{pXE|1dOo4Exe&NjGiZL>4UV4Jix-eHLvh7RE8n znutmm6C{(*0lU0;%-w}2o=Y;HH?P7)M`E^RUL_N*oYy7} zeKzPecksaB`KhBb#}6zXpF7Iut~w;HZ#MZqw^sZxQpN#JdE8=CWO@$Zl;#_eA*kuH zo!T24@^sf!r#fs1Tp8*#If^9s-W6^b!Meb~e!>d)&IsK^GKe7`(DqE1?(2l2fmCDT z1o`HTmeX#lK$O1Yr<+$FblF3jnz0OsNtMK{&d(+!Esv->W=TA&FNUE*NVx!pF3W^3 zvKIj9j-Q@G$sIp3^2mrXBma;*U8k@06};i*Smg74F1|*EizRH%ktwGhqm9%AgYAmz zN@VnfW{CSlvSq?{qsv`BTY~(Hc`t%Z_D)X9gAAXugPt{UP0E#rsTGdm*5jU*Uxq`w zbi*iPThiAZ=1D84rB|pjZBL2_*YjX%-8zr^Xx{Q|^%`|k_-)-w6~W8L>i*l2Al_0- d&ALsDxnyf79BJ$ly$&NmX+(aotx#ei{0DFuPq_d9 literal 0 HcmV?d00001 diff --git a/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala b/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala index 73d97e23..870acce7 100644 --- a/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala +++ b/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala @@ -50,7 +50,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { SpectralDefinition.BandNormalized( UnnormalizedSED.StellarLibrary(StellarLibrarySpectrum.A0V).some, SortedMap( - Band.R -> BrightnessValue(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged + Band.R -> BrightnessValue.unsafeFrom(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged ) ) ), @@ -378,7 +378,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { .body( StringBody( bodyIntMagUnits( - f.withValueTagged(BrightnessValue(BigDecimal(5))) + f.withValueTagged(BrightnessValue.unsafeFrom(BigDecimal(5))) ).asJson.noSpaces ) ) @@ -414,7 +414,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { .body( StringBody( bodySurfaceMagUnits( - f.withValueTagged(BrightnessValue(BigDecimal(5))) + f.withValueTagged(BrightnessValue.unsafeFrom(BigDecimal(5))) ).asJson.noSpaces ) ) @@ -451,7 +451,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { .body( StringBody( bodyIntGaussianMagUnits( - f.withValueTagged(BrightnessValue(BigDecimal(5))) + f.withValueTagged(BrightnessValue.unsafeFrom(BigDecimal(5))) ).asJson.noSpaces ) ) @@ -466,7 +466,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { SpectralDefinition.BandNormalized( UnnormalizedSED.PowerLaw(c).some, SortedMap( - Band.R -> BrightnessValue(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged + Band.R -> BrightnessValue.unsafeFrom(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged ) ) ) @@ -501,7 +501,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { SpectralDefinition.BandNormalized( UnnormalizedSED.BlackBody(c.withUnit[Kelvin]).some, SortedMap( - Band.R -> BrightnessValue(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged + Band.R -> BrightnessValue.unsafeFrom(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged ) ) ) diff --git a/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala b/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala index 2b35e6eb..5efe56ef 100644 --- a/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala +++ b/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala @@ -18,9 +18,9 @@ given [T]: Encoder[BandNormalized[T]] with Json.fromFields( List( "band" -> b.asScreamingJson, - "value" -> m.value.asJson, + "value" -> m.value.value.value.asJson, "units" -> m.units.serialized.asJson - ) ++ m.error.toList.map(v => "error" -> v.asJson) + ) ++ m.error.toList.map(v => "error" -> v.value.value.asJson) ) }: _*) ) diff --git a/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala b/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala index b5c2cba2..19d1abf1 100644 --- a/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala +++ b/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala @@ -264,21 +264,21 @@ given Encoder[ItcSourceDefinition] = (s: ItcSourceDefinition) => if brightnesses.contains(s.normBand) => brightnesses .get(s.normBand) - .map(_.value.value.toDouble) + .map(_.value.value.value.toDouble) .flatMap(Json.fromDouble) .getOrElse(Json.Null) case SourceProfile.Uniform(SpectralDefinition.BandNormalized(_, brightnesses)) if brightnesses.contains(s.normBand) => brightnesses .get(s.normBand) - .map(_.value.value.toDouble) + .map(_.value.value.value.toDouble) .flatMap(Json.fromDouble) .getOrElse(Json.Null) case SourceProfile.Gaussian(_, SpectralDefinition.BandNormalized(_, brightnesses)) if brightnesses.contains(s.normBand) => brightnesses .get(s.normBand) - .map(_.value.value.toDouble) + .map(_.value.value.value.toDouble) .flatMap(Json.fromDouble) .getOrElse(Json.Null) // FIXME: Handle emission line diff --git a/modules/service/src/main/scala/lucuma/itc/service/ItcPartials.scala b/modules/service/src/main/scala/lucuma/itc/service/ItcPartials.scala index 929d52bc..249438db 100644 --- a/modules/service/src/main/scala/lucuma/itc/service/ItcPartials.scala +++ b/modules/service/src/main/scala/lucuma/itc/service/ItcPartials.scala @@ -227,11 +227,11 @@ trait GracklePartials extends GrackleParsers: ) ) => val band = bandItems.get(b) - val value = bigDecimalValue(v) + val value = bigDecimalValue(v).flatMap(bd => BrightnessValue.from(bd).toOption) val units = unitsItems.get(u) (band, value, units) .mapN { (b, v, u) => - b -> u.withValueTagged(BrightnessValue(v)) + b -> u.withValueTagged(v) } .toRightIorNec("Invalid brightness") case e => s"Invalid brightness entry $e".leftIorNec From f086d4f5a02408c86c98be7c29c796131dd30366 Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 13:35:18 -0300 Subject: [PATCH 03/13] sbt-lucuma-lib plugin --- .build.sbt.swp | Bin 20480 -> 20480 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.build.sbt.swp b/.build.sbt.swp index 1e908bb4d25e19d90bfb5d1dbf76a52e82170fe5..8f1825107eb1608e03ce2cdadac0bac4305d3c6f 100644 GIT binary patch delta 23 fcmZozz}T>Wal?CN#?Z|lnBQwMnr(idtDpn`bUq0( delta 23 fcmZozz}T>Wal?CNMuyEFnBQwMnr?oetDpn`Z|4Zy From 736ff7acade2b14df392027e4b5ccf786b0318fc Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 13:40:49 -0300 Subject: [PATCH 04/13] 0.67.0 --- .build.sbt.swp | Bin 20480 -> 20480 bytes .../itc/client/json/EmissionLinesJson.scala | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.build.sbt.swp b/.build.sbt.swp index 8f1825107eb1608e03ce2cdadac0bac4305d3c6f..5a24d15a94a77d8f87eab4883008b303c84d85d3 100644 GIT binary patch delta 48 zcmZozz}T>WQ9Q{Y%+puFQqO<^2m}}yc++1che|BlD1L*Pkzw-(=J%S6=9?erDkuQ} DKV}XO delta 48 zcmZozz}T>WQ9Q{Y%+puFQqO<^2m}}yHpRb64*IopqxcPG#?Z|lnBQwMnr(idtDpn` DWMmKC diff --git a/modules/client/shared/src/main/scala/lucuma/itc/client/json/EmissionLinesJson.scala b/modules/client/shared/src/main/scala/lucuma/itc/client/json/EmissionLinesJson.scala index c06fb677..ba9474ae 100644 --- a/modules/client/shared/src/main/scala/lucuma/itc/client/json/EmissionLinesJson.scala +++ b/modules/client/shared/src/main/scala/lucuma/itc/client/json/EmissionLinesJson.scala @@ -14,17 +14,17 @@ given [T]: Encoder[EmissionLines[T]] with "lines" -> Json.arr(el.lines.toList.map { case (w, l) => Json.obj( "wavelength" -> w.asJson, - "lineWidth" -> l.lineWidth.value.asJson, + "lineWidth" -> l.lineWidth.value.value.value.asJson, "lineFlux" -> Json.obj( - "value" -> l.lineFlux.value.value.asJson, + "value" -> l.lineFlux.value.value.value.asJson, "units" -> l.lineFlux.units.serialized.asJson ) ) }: _*), "fluxDensityContinuum" -> Json.obj( - "value" -> el.fluxDensityContinuum.value.value.asJson, + "value" -> el.fluxDensityContinuum.value.value.value.asJson, "units" -> el.fluxDensityContinuum.units.serialized.asJson ) ) From 4bf00f8cec1bc4d4c33d2903b43b2405c7fd3f80 Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 14:17:16 -0300 Subject: [PATCH 05/13] clue and routes --- .build.sbt.swp | Bin 20480 -> 16384 bytes build.sbt | 9 +++++++++ 2 files changed, 9 insertions(+) diff --git a/.build.sbt.swp b/.build.sbt.swp index 5a24d15a94a77d8f87eab4883008b303c84d85d3..4880652b92eafcc70b14b95439a778dd8113d322 100644 GIT binary patch delta 433 zcmXZYPbh-{7{~GF-Rre?dxw$3+G*T`*Q@4W%^X}dMY+g9X_O{vEGd6#%Y~Dg_k`3= z+=%xug-|=VXbl%PH#KsWCcX#1`qXpy9iHdO6_i{~2~Jz%iIGshX$kR*3@=t^-or<7 z|8N#8tNDWFe5w(j{`()t@;^6eZn}=`2~B0Md?I|!}!zxmkKm!bT@uZ6^>yniW!xBscpyQkUK2X9gl8B%O9r&sjIYAop zm_rI<2;xT*c|{3D9AX0r3}Fy4xU@J|)rpi*!~u4Y#wa|vQ$;p0fSOC>66=Vfrtn9c kE6!oqW#CdHA*aAgK!7f=9Q?ePkWavA@HBV| z>;XEc2j>?N@-=uByaM)vDImZ@pcyoQM(_1D5kfY#XFa!obKe!1TUqZ-Xup6|4 zHqZ*{!H>w>S@14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j2l1B(Cv diff --git a/build.sbt b/build.sbt index 0c41467d..1fcb146e 100644 --- a/build.sbt +++ b/build.sbt @@ -6,8 +6,13 @@ val catsVersion = "2.9.0" val catsScalacheckVersion = "0.3.1" val catsTimeVersion = "0.3.4" val circeVersion = "0.14.3" +<<<<<<< HEAD val cirisVersion = "3.1.0" val clueVersion = "0.23.2" +======= +val cirisVersion = "3.0.0" +val clueVersion = "0.24.0" +>>>>>>> 8d6f5b4 (clue and routes) val http4sVersion = "0.23.18" val http4sJdkHttpClientVersion = "0.9.0" val fs2Version = "3.6.1" @@ -18,7 +23,11 @@ val slf4jVersion = "2.0.6" val log4catsVersion = "2.5.0" val monocleVersion = "3.1.0" val munitCatsEffectVersion = "1.0.7" +<<<<<<< HEAD val graphQLRoutesVersion = "0.5.9" +======= +val graphQLRoutesVersion = "0.5.10" +>>>>>>> 8d6f5b4 (clue and routes) val refinedVersion = "0.10.1" val grackleVersion = "0.10.3" val natcchezHttp4sVersion = "0.5.0" From 10b118d0c4e2add127285b85c87c46d07b6b5740 Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 14:24:56 -0300 Subject: [PATCH 06/13] prePR and mima --- .build.sbt.swp | Bin 16384 -> 0 bytes build.sbt | 11 +---------- .../scala/lucuma/itc/LegacyITCSimulation.scala | 15 ++++++++++++--- 3 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 .build.sbt.swp diff --git a/.build.sbt.swp b/.build.sbt.swp deleted file mode 100644 index 4880652b92eafcc70b14b95439a778dd8113d322..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHNO^h5z6)s{3`N0?hNCcY1erHrS56M)t;uZDs9^cWrS%TGjN_%#^pM zd(zdj_O1y?xqy(82si;k;(#C$QV#fFK|l#o4v`Q-fRGRe1SnD@!-X3Jqwv+M>Ynb| z*)>@r!J$X`W_qe$y?XV%s@GMox;1y@+%iAr&oO*Hz}Wf0?cgs9-(#=+f-!wfgc~w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$jD#uO7d zPSoi&@}8C5e{anwZN>3G1sma*-P8=4X!r~MoX3phhDuWz=`lO3J!H&WCOH@+DoQ5` zVjzK!qv#^(Ok`W>g(W=LcS@IA*8>EkokE$NbAID!)_hl_A)bO0g~?F7v1^-0c8<*X#tiyzv0jMM;ude6bBQB6Peod zA!{YESXeM?x=E&@`FTI@z79JJS0{ZKkanVo6+U`F~QX}KZ#J0lLz#L9 zNmywlnWD!Rzko;drd+`s6kVB|mEk}p{yLsZj2*^a_n&~-|NAZn@e=m=+iuVQ5A5yD ze*Xq=0=R=c{Y^jvP2g|X%YO%00nP)D0cU_3a4+y%?CD@6P~-flmQ%xjvXZef6mrs2Hdis2Hdi zs2JFlfh=of_Sugm$b?*rlMUqR7WwjJ>?HCcW>yr_dAgYL&czIu$uzoUaGh4Uqm(a_ zgu5@0r)Wb>+Fjzzt`bLCWc$BO9EIE=b_s1Hd2xE6hudOf=*@61PXw$Z0nwx^mXR*Xm)(Xsv?;Im zg-K|XtC8}q-H4kp=ecVlyxz%XjJf6RxOIAFCvsRt11XoDn@AdMYGT@EVQmK1=|EC4 zX@Su2aqG%fmu>9Kbd3ugeaVic+k?>~Xf&Ga;ZrGNFvI>0C4&6m diff --git a/build.sbt b/build.sbt index 1fcb146e..37464bf0 100644 --- a/build.sbt +++ b/build.sbt @@ -6,13 +6,8 @@ val catsVersion = "2.9.0" val catsScalacheckVersion = "0.3.1" val catsTimeVersion = "0.3.4" val circeVersion = "0.14.3" -<<<<<<< HEAD val cirisVersion = "3.1.0" -val clueVersion = "0.23.2" -======= -val cirisVersion = "3.0.0" val clueVersion = "0.24.0" ->>>>>>> 8d6f5b4 (clue and routes) val http4sVersion = "0.23.18" val http4sJdkHttpClientVersion = "0.9.0" val fs2Version = "3.6.1" @@ -23,11 +18,7 @@ val slf4jVersion = "2.0.6" val log4catsVersion = "2.5.0" val monocleVersion = "3.1.0" val munitCatsEffectVersion = "1.0.7" -<<<<<<< HEAD -val graphQLRoutesVersion = "0.5.9" -======= val graphQLRoutesVersion = "0.5.10" ->>>>>>> 8d6f5b4 (clue and routes) val refinedVersion = "0.10.1" val grackleVersion = "0.10.3" val natcchezHttp4sVersion = "0.5.0" @@ -45,7 +36,7 @@ Global / onChangedBuildSource := ReloadOnSourceChanges ThisBuild / scalaVersion := "3.2.2" ThisBuild / crossScalaVersions := Seq("3.2.2") -ThisBuild / tlBaseVersion := "0.5" +ThisBuild / tlBaseVersion := "0.6" ThisBuild / tlCiReleaseBranches := Seq("master") Global / onChangedBuildSource := ReloadOnSourceChanges diff --git a/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala b/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala index 870acce7..b97816f2 100644 --- a/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala +++ b/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala @@ -50,7 +50,10 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { SpectralDefinition.BandNormalized( UnnormalizedSED.StellarLibrary(StellarLibrarySpectrum.A0V).some, SortedMap( - Band.R -> BrightnessValue.unsafeFrom(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged + Band.R -> BrightnessValue + .unsafeFrom(BigDecimal(5)) + .withUnit[VegaMagnitude] + .toMeasureTagged ) ) ), @@ -466,7 +469,10 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { SpectralDefinition.BandNormalized( UnnormalizedSED.PowerLaw(c).some, SortedMap( - Band.R -> BrightnessValue.unsafeFrom(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged + Band.R -> BrightnessValue + .unsafeFrom(BigDecimal(5)) + .withUnit[VegaMagnitude] + .toMeasureTagged ) ) ) @@ -501,7 +507,10 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { SpectralDefinition.BandNormalized( UnnormalizedSED.BlackBody(c.withUnit[Kelvin]).some, SortedMap( - Band.R -> BrightnessValue.unsafeFrom(BigDecimal(5)).withUnit[VegaMagnitude].toMeasureTagged + Band.R -> BrightnessValue + .unsafeFrom(BigDecimal(5)) + .withUnit[VegaMagnitude] + .toMeasureTagged ) ) ) From 22af19fc8920f1da4a5bb37ddbc6d28f0ec04545 Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 14:31:30 -0300 Subject: [PATCH 07/13] Unused import --- .../main/scala/lucuma/itc/search/syntax/GmosNorthFilter.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosNorthFilter.scala b/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosNorthFilter.scala index 64f64b91..255a2c44 100644 --- a/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosNorthFilter.scala +++ b/modules/itc/src/main/scala/lucuma/itc/search/syntax/GmosNorthFilter.scala @@ -6,7 +6,6 @@ package lucuma.itc.search.syntax import cats.implicits._ import lucuma.core.enums.GmosNorthFilter import lucuma.core.enums.GmosNorthFilter._ -import lucuma.core.math.BoundedInterval import lucuma.core.math.Wavelength import spire.math.Interval From cdced0e8dc88da5a085aefde4145834b334e919b Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 14:43:34 -0300 Subject: [PATCH 08/13] cleanup --- .../itc/client/json/BandNormalizedJson.scala | 3 ++- .../itc/client/json/EmissionLinesJson.scala | 7 ++++--- .../main/scala/lucuma/itc/legacy/encoders.scala | 16 +++++++--------- .../scala/lucuma/itc/search/ObservingMode.scala | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala b/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala index 5efe56ef..03d4e51d 100644 --- a/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala +++ b/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala @@ -5,6 +5,7 @@ package lucuma.itc.client.json import io.circe.Encoder import io.circe.Json +import io.circe.refined.* import io.circe.syntax.* import lucuma.core.model.SpectralDefinition.BandNormalized @@ -18,7 +19,7 @@ given [T]: Encoder[BandNormalized[T]] with Json.fromFields( List( "band" -> b.asScreamingJson, - "value" -> m.value.value.value.asJson, + "value" -> m.value.asJson, "units" -> m.units.serialized.asJson ) ++ m.error.toList.map(v => "error" -> v.value.value.asJson) ) diff --git a/modules/client/shared/src/main/scala/lucuma/itc/client/json/EmissionLinesJson.scala b/modules/client/shared/src/main/scala/lucuma/itc/client/json/EmissionLinesJson.scala index ba9474ae..876166ca 100644 --- a/modules/client/shared/src/main/scala/lucuma/itc/client/json/EmissionLinesJson.scala +++ b/modules/client/shared/src/main/scala/lucuma/itc/client/json/EmissionLinesJson.scala @@ -5,6 +5,7 @@ package lucuma.itc.client.json import io.circe.Encoder import io.circe.Json +import io.circe.refined.* import io.circe.syntax.* import lucuma.core.model.SpectralDefinition.EmissionLines @@ -14,17 +15,17 @@ given [T]: Encoder[EmissionLines[T]] with "lines" -> Json.arr(el.lines.toList.map { case (w, l) => Json.obj( "wavelength" -> w.asJson, - "lineWidth" -> l.lineWidth.value.value.value.asJson, + "lineWidth" -> l.lineWidth.value.asJson, "lineFlux" -> Json.obj( - "value" -> l.lineFlux.value.value.value.asJson, + "value" -> l.lineFlux.value.asJson, "units" -> l.lineFlux.units.serialized.asJson ) ) }: _*), "fluxDensityContinuum" -> Json.obj( - "value" -> el.fluxDensityContinuum.value.value.value.asJson, + "value" -> el.fluxDensityContinuum.value.asJson, "units" -> el.fluxDensityContinuum.units.serialized.asJson ) ) diff --git a/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala b/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala index 19d1abf1..657b80c9 100644 --- a/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala +++ b/modules/itc/src/main/scala/lucuma/itc/legacy/encoders.scala @@ -7,6 +7,7 @@ import cats.data.NonEmptyList import cats.syntax.all._ import io.circe.* import io.circe.generic.semiauto._ +import io.circe.refined.* import io.circe.syntax.* import lucuma.core.enums._ import lucuma.core.math.Angle @@ -264,23 +265,20 @@ given Encoder[ItcSourceDefinition] = (s: ItcSourceDefinition) => if brightnesses.contains(s.normBand) => brightnesses .get(s.normBand) - .map(_.value.value.value.toDouble) - .flatMap(Json.fromDouble) - .getOrElse(Json.Null) + .map(_.value) + .asJson case SourceProfile.Uniform(SpectralDefinition.BandNormalized(_, brightnesses)) if brightnesses.contains(s.normBand) => brightnesses .get(s.normBand) - .map(_.value.value.value.toDouble) - .flatMap(Json.fromDouble) - .getOrElse(Json.Null) + .map(_.value) + .asJson case SourceProfile.Gaussian(_, SpectralDefinition.BandNormalized(_, brightnesses)) if brightnesses.contains(s.normBand) => brightnesses .get(s.normBand) - .map(_.value.value.value.toDouble) - .flatMap(Json.fromDouble) - .getOrElse(Json.Null) + .map(_.value) + .asJson // FIXME: Handle emission line case _ => Json.Null } diff --git a/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala b/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala index 08ea7b21..69d74070 100644 --- a/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala +++ b/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala @@ -83,7 +83,7 @@ object ObservingMode { disperser.resolution(λ, fpu.effectiveSlitWidth) def coverage: Interval[Wavelength] = - filter.foldLeft(disperser.coverage(λ).toInterval)(_ intersect _.coverageGN) + filter.foldLeft(disperser.coverage(λ).toInterval)((a, b) => a.intersect(b.coverageGN)) } object GmosNorth: @@ -111,7 +111,7 @@ object ObservingMode { disperser.resolution(λ, fpu.effectiveSlitWidth) def coverage: Interval[Wavelength] = - filter.foldLeft(disperser.coverage(λ).toInterval)(_ intersect _.coverageGS) + filter.foldLeft(disperser.coverage(λ).toInterval)((a,b) => a.intersect(b.coverageGS)) } object GmosSouth: From f063b59590e394fb5630192ea03c683a26fb9442 Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 14:46:00 -0300 Subject: [PATCH 09/13] format --- .../itc/src/main/scala/lucuma/itc/search/ObservingMode.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala b/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala index 69d74070..22924a95 100644 --- a/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala +++ b/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala @@ -111,7 +111,7 @@ object ObservingMode { disperser.resolution(λ, fpu.effectiveSlitWidth) def coverage: Interval[Wavelength] = - filter.foldLeft(disperser.coverage(λ).toInterval)((a,b) => a.intersect(b.coverageGS)) + filter.foldLeft(disperser.coverage(λ).toInterval)((a, b) => a.intersect(b.coverageGS)) } object GmosSouth: From 87593a8cafdb54b015c53d1cb5674e99a9d967ed Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 14:51:37 -0300 Subject: [PATCH 10/13] cleanup --- .../main/scala/lucuma/itc/client/json/BandNormalizedJson.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala b/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala index 03d4e51d..d054b02e 100644 --- a/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala +++ b/modules/client/shared/src/main/scala/lucuma/itc/client/json/BandNormalizedJson.scala @@ -21,7 +21,7 @@ given [T]: Encoder[BandNormalized[T]] with "band" -> b.asScreamingJson, "value" -> m.value.asJson, "units" -> m.units.serialized.asJson - ) ++ m.error.toList.map(v => "error" -> v.value.value.asJson) + ) ++ m.error.toList.map(v => "error" -> v.asJson) ) }: _*) ) From 9a48f1d92b86a47f56a765601930f07f6a1f3adc Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Mon, 13 Feb 2023 14:55:17 -0300 Subject: [PATCH 11/13] unused import --- modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala b/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala index 22924a95..163e22d8 100644 --- a/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala +++ b/modules/itc/src/main/scala/lucuma/itc/search/ObservingMode.scala @@ -9,7 +9,6 @@ import io.circe.* import io.circe.syntax.* import lucuma.core.enums._ import lucuma.core.math.Angle -import lucuma.core.math.BoundedInterval import lucuma.core.math.Wavelength import lucuma.itc.GmosNITCParams import lucuma.itc.GmosSITCParams From fcdabc83c0215c2e6c0d4ff740626084913f7eab Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Tue, 14 Feb 2023 09:47:06 -0300 Subject: [PATCH 12/13] clue --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 37464bf0..01bc0d7e 100644 --- a/build.sbt +++ b/build.sbt @@ -7,7 +7,7 @@ val catsScalacheckVersion = "0.3.1" val catsTimeVersion = "0.3.4" val circeVersion = "0.14.3" val cirisVersion = "3.1.0" -val clueVersion = "0.24.0" +val clueVersion = "0.24.1" val http4sVersion = "0.23.18" val http4sJdkHttpClientVersion = "0.9.0" val fs2Version = "3.6.1" From 7a21dd199c9cf476789505e4bdbc1681cdc0718e Mon Sep 17 00:00:00 2001 From: Shane Walker Date: Tue, 14 Feb 2023 12:56:51 -0300 Subject: [PATCH 13/13] cleanup --- .../test/scala/lucuma/itc/LegacyITCSimulation.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala b/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala index b97816f2..72015798 100644 --- a/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala +++ b/modules/benchmarks/src/test/scala/lucuma/itc/LegacyITCSimulation.scala @@ -51,7 +51,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { UnnormalizedSED.StellarLibrary(StellarLibrarySpectrum.A0V).some, SortedMap( Band.R -> BrightnessValue - .unsafeFrom(BigDecimal(5)) + .unsafeFrom(5) .withUnit[VegaMagnitude] .toMeasureTagged ) @@ -381,7 +381,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { .body( StringBody( bodyIntMagUnits( - f.withValueTagged(BrightnessValue.unsafeFrom(BigDecimal(5))) + f.withValueTagged(BrightnessValue.unsafeFrom(5)) ).asJson.noSpaces ) ) @@ -417,7 +417,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { .body( StringBody( bodySurfaceMagUnits( - f.withValueTagged(BrightnessValue.unsafeFrom(BigDecimal(5))) + f.withValueTagged(BrightnessValue.unsafeFrom(5)) ).asJson.noSpaces ) ) @@ -454,7 +454,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { .body( StringBody( bodyIntGaussianMagUnits( - f.withValueTagged(BrightnessValue.unsafeFrom(BigDecimal(5))) + f.withValueTagged(BrightnessValue.unsafeFrom(5)) ).asJson.noSpaces ) ) @@ -470,7 +470,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { UnnormalizedSED.PowerLaw(c).some, SortedMap( Band.R -> BrightnessValue - .unsafeFrom(BigDecimal(5)) + .unsafeFrom(5) .withUnit[VegaMagnitude] .toMeasureTagged ) @@ -508,7 +508,7 @@ class LegacyITCSimulation extends GatlingHttpFunSpec { UnnormalizedSED.BlackBody(c.withUnit[Kelvin]).some, SortedMap( Band.R -> BrightnessValue - .unsafeFrom(BigDecimal(5)) + .unsafeFrom(5) .withUnit[VegaMagnitude] .toMeasureTagged )