Skip to content
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

Merged

Conversation

rpiaggio
Copy link
Contributor

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 as InstrumentRow) when computing each possible row of the modes table. Also, the selected configuration is now on InstrumentConfig instead of a BasicConfig. 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.

Copy link

bundlemon bot commented Oct 30, 2024

BundleMon

Files updated (2)
Status Path Size Limits
exploreworkers-(hash).js
606.53KB (+473B +0.08%) -
index-(hash).js
1.74MB (+396B +0.02%) -
Unchanged files (6)
Status Path Size Limits
index-(hash).css
65.97KB -
workbox-window.prod.es5-(hash).js
2.07KB -
plotworker-(hash).js
84B -
catalogworker-(hash).js
82B -
itcworker-(hash).js
82B -
agsworker-(hash).js
76B -

Total files change +868B +0.03%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

).some
)
>> props.deleteConfig
onClick = props.deleteConfig
Copy link
Contributor

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 =>
Copy link
Contributor

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)
Copy link
Contributor

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...

Copy link
Contributor Author

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.

Copy link
Contributor Author

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),
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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")
Copy link
Contributor

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(
Copy link
Contributor

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?

Copy link
Contributor

@cquiroz cquiroz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks

@rpiaggio rpiaggio merged commit 447bd80 into master Oct 30, 2024
14 checks passed
@rpiaggio rpiaggio deleted the sc-3813-different-itc-output-before-and-after-accepting branch October 30, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants