-
Notifications
You must be signed in to change notification settings - Fork 5
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
Simplify and unify ITC model #4270
Simplify and unify ITC model #4270
Conversation
BundleMonFiles updated (2)
Unchanged files (6)
Total files change +868B +0.03% Final result: ✅ View report in BundleMon website ➡️ |
).some | ||
) | ||
>> props.deleteConfig | ||
onClick = props.deleteConfig |
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.
Should this be revertConfig
?
yield ItcClient[IO] | ||
.requestSingle: | ||
ItcMessage.GraphQuery(w, sn, snAt, constraints, t, mode) | ||
.map: | ||
_.toRight(new Throwable("No response from ITC server.")) | ||
.rethrow | ||
.flatTap: result => |
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.
debugging?
.useState(Pot.pending[ItcAsterismGraphResults]) // itcGraphResults | ||
.useAsyncEffectWithDepsBy((props, _, _, _, selectedConfig, _, _) => | ||
itcQueryProps(props.observation.get, selectedConfig.get, props.allTargets) | ||
ItcProps(props.observation.get, selectedConfig.get, props.obsTargets) |
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.
Caan this be combined in one hook? Like one of those useResourceWhen...
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.
Let me check. At the very least, we can use a localVal
so that we don't build ItcProps
twice.
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 was able to simplify quite a bit by using localVal
and useEffectResult
. Thanks for the suggestion!
InstrumentOverrides | ||
.GmosSpectroscopy( | ||
cw, | ||
GmosCcdMode.defaultGmosNorth(profiles, fpu, grating, imageQuality), |
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.
Nice, I didn't notice this method. Is it from lucuma-core
?
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.
It's an extension I created. But I think it should be moved to lucuma-core
in the future.
import lucuma.core.model.sequence.gmos.longslit.* | ||
|
||
object syntax: | ||
// TODO Actually move to lucuma-core, to GmosCcdMode |
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.
👍 so odb can use it too
none | ||
|
||
def doRequest(request: ItcGraphRequestParams): F[ItcAsterismGraphResults] = | ||
request.mode.toItcClientMode | ||
.map: mode => | ||
println(s"request for mode $mode") |
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.
println
@@ -73,7 +71,7 @@ object ITCRequests: | |||
params: ItcRequestParams | |||
): F[Option[Map[ItcRequestParams, EitherNec[ItcTargetProblem, ItcResult]]]] = | |||
Logger[F] | |||
.debug( | |||
.info( |
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.
Should it go back to debug
?
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.
Looks great, thanks
A bug was reported where invocations to ITC did not include CCD mode information when invoked before selecting a configuration.
This PR attempts to fix that by computing the necessary overrides for the current observations. This is now computed and stored in
InstrumentConfig
(previously known asInstrumentRow
) when computing each possible row of the modes table. Also, the selected configuration is now onInstrumentConfig
instead of aBasicConfig
. This simplifies keeping track of the overrides since now they are in the selected object. In particular,ItcProps
is simplified.ITC results before and after configuration selection are now consistent.