Closed tlambert03 closed 1 year ago
also gave the examples a shot:
$ python examples/parallel_psf.py
...
Traceback (most recent call last):
File "/Users/talley/dev/forks/chromatix/examples/parallel_psf.py", line 33, in <module>
widefield_psf = compute_psf(z)
File "/Users/talley/dev/forks/chromatix/examples/parallel_psf.py", line 29, in compute_psf
return optical_model.apply({}, z).intensity
File "/Users/talley/dev/forks/chromatix/src/chromatix/systems/optical_system.py", line 31, in __call__
field = self.elements[0](*args, **kwargs) # allow field to be initialized
File "/Users/talley/dev/forks/chromatix/src/chromatix/elements/sources.py", line 115, in __call__
f = register(self, "f")
File "/Users/talley/dev/forks/chromatix/src/chromatix/elements/utils.py", line 26, in register
return module.variable(
flax.errors.ScopeCollectionNotFound: Tried to access "_f" from collection "state" in "/elements_0" but the collection is empty. (https://flax.readthedocs.io/en/latest/api_reference/flax.errors.html#flax.errors.ScopeCollectionNotFound)
and
$ python examples/parallel_psf.py
...
Traceback (most recent call last):
File "/Users/talley/dev/forks/chromatix/examples/parallel_imaging.py", line 54, in <module>
params = init_params(jax.random.PRNGKey(6022), volume, z)
File "/Users/talley/dev/forks/chromatix/examples/parallel_imaging.py", line 43, in init_params
params = microscope.init(key, volume, z)
File "/Users/talley/dev/forks/chromatix/src/chromatix/systems/microscopes.py", line 87, in __call__
system_psf = self.psf(*args, **kwargs)
File "/Users/talley/dev/forks/chromatix/src/chromatix/systems/microscopes.py", line 99, in psf
return self.system_psf(self, *args, **kwargs)
File "/Users/talley/dev/forks/chromatix/src/chromatix/systems/microscopes.py", line 211, in __call__
psf = system(z)
File "/Users/talley/dev/forks/chromatix/src/chromatix/systems/optical_system.py", line 33, in __call__
field = element(field)
File "/Users/talley/dev/forks/chromatix/src/chromatix/elements/phase_masks.py", line 68, in __call__
phase = register(
File "/Users/talley/dev/forks/chromatix/src/chromatix/elements/utils.py", line 24, in register
return module.param(f"_{name}", parse_init(init.val), *args)
File "/Users/talley/dev/forks/chromatix/src/chromatix/functional/phase_masks.py", line 49, in flat_phase
return jnp.full(shape, value)
File "/Users/talley/mambaforge/envs/chromatix/lib/python3.10/site-packages/jax/_src/numpy/lax_numpy.py", line 2058, in full
return lax.full(shape, fill_value, dtype)
jaxlib.xla_extension.XlaRuntimeError: UNKNOWN: <unknown>:0: error: invalid shape type=11, dims=[3235068045,3032181039]:
<unknown>:0: note: see current operation: "func.return"(%0) : (tensor<3235068045x3032181039xf32>) -> ()
not complaining! I know how hard it is to develop a very new project and keep the docs/examples working. 😄
anyway, really excited for what's happening here and look forward to digging in some more!
incidentally, if you run the "usage" example in the readme, you get the same flax error:
ScopeCollectionNotFound: Tried to access "_f" from collection "state" in "/elements_0" but the collection is empty.
my environment: Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:17:34) [Clang 14.0.6 ] macos 12.6.5
Hi @tlambert03, thanks for your interest! You're right - 101 is currently broken. We had a hackathon a few weeks ago and made some changes based on the feedback we got, and we're almost finished with updating the docs - but not quite ;-)
We hope to update 101 next week. There's some small changes to the code, but the main ideas are the same. The examples in our documentation should work though! (https://chromatix.readthedocs.io/en/latest/examples/cgh/ for example).
We're working on CI for the docs so hopefully this doesn't happen anymore, but we haven't got around to it.
We had a hackathon a few weeks ago
yeah I was in the audience at your final presentation drooling 🤤 (was at the other hackathon) finally getting around to trying it. will check out the docs examples next. thanks again!
yep, holoscope.ipynb works great. thanks
Maybe we should have put some warnings up about being in an "alpha" state :slightly_smiling_face:
But thanks for checking things out and pointing out what was broken! I've updated the 101 and all the other examples that you tried that didn't work. We can still improve 101 to make it a better introduction to Chromatix and simulating optics in general, but it'll do for now.
A note about the parallel imaging and PSF examples: those just got updated but you'll need to make sure to either change the number of devices in the code before running the example or run on a system that has 4 GPUs.
No need for alpha warning. It's understood :)
just a courtesy note: the "chromatix 101 docs" appear to be out of date.