-
Notifications
You must be signed in to change notification settings - Fork 6
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
Detectors do not have pydantic discriminator field #90
Comments
let's go ahead and add one! In practice, I suspect that once TLDR:
|
Ok great! I was uncertain about it because the binning is different for the CMOS camera in the microsim/src/microsim/schema/detectors/_simulate.py Lines 82 to 84 in 8f1ee38
|
Ah indeed, that would make a difference for anything with a binning != 1. All the more reason to add the discriminator. Thanks for noting that |
Probably would have been more obvious if the simulate_camera function were a method on these cameras. So perhaps that would also be a good change here |
I can make a PR to add the discriminator if you like, but I'll probably leave the refactoring work to move the Couple of questions:
|
thanks @melisande-c, I did the method refactor in #91, and added the |
Ah amazing! Thanks! |
Description
Hi @tlambert03,
I've noticed that your detector classes do not have a discriminator field, like, for example, your modality classes do. I'd like to save the settings that I ran my simulations with, and then potentially load the same settings; it would be convenient to just use the pydantic
model_dump
method, but the lack of a detector discriminator complicates things slightly.The following code snippet demonstrates what I mean. When I load the output of
model_dump
, the detector type is not the original that I chose. I assume the resulting camera type is the first that pydantic finds.Output:
Thanks☺️
The text was updated successfully, but these errors were encountered: