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

Field distortion correction throws errors with non-default map #97

Open
sebvetter opened this issue Jan 11, 2024 · 1 comment
Open

Field distortion correction throws errors with non-default map #97

sebvetter opened this issue Jan 11, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sebvetter
Copy link
Contributor

In the ElectronDrift plugin there are 3 possibilities for the field distortion correction: inverse_fdc, comsol or anything else. The defaut is comsol. See here.

When set to inverse_fdc, the ElectronDrift plugin throws an assertion error (full trace in comment):

AssertionError: Scaling factor array dimension 3 does not match grid dimension 2

@sebvetter sebvetter added the bug Something isn't working label Jan 11, 2024
@sebvetter
Copy link
Contributor Author

sebvetter commented Jan 11, 2024

Full error trace:

AssertionError                            Traceback (most recent call last)
Cell In[6], line 1
----> 1 st.make(run_number, "drifted_electrons")
      2 st.make(run_number, "extracted_electrons")
      3 st.make(run_number, "electron_time")

File ~/software/strax/strax/context.py:1435, in Context.make(self, run_id, targets, save, max_workers, _skip_if_built, **kwargs)
   1432 if _skip_if_built and self.is_stored(run_id, targets):
   1433     return
-> 1435 for _ in self.get_iter(run_ids[0], targets,
   1436                        save=save, max_workers=max_workers, **kwargs):
   1437     pass

File ~/software/strax/strax/context.py:1286, in Context.get_iter(self, run_id, targets, save, max_workers, time_range, seconds_range, time_within, time_selection, selection, selection_str, keep_columns, drop_columns, allow_multiple, progress_bar, _chunk_number, **kwargs)
   1277     elif (self.context_config['timeout'] > 7200 or (
   1278             self.context_config['allow_lazy'] and
   1279             not self.context_config['allow_multiprocess'])):
   1280         # For allow_multiple we don't want allow this when in lazy mode
   1281         # with long timeouts (lazy-mode is disabled if multiprocessing
   1282         # so if that is activated, we can also continue)
   1283         raise RuntimeError(f'Cannot allow_multiple in lazy mode or '
   1284                            f'with long timeouts.')
-> 1286 components = self.get_components(run_id,
   1287                                  targets=targets,
   1288                                  save=save,
   1289                                  time_range=time_range,
   1290                                  chunk_number=_chunk_number)
   1292 # Cleanup the temp plugins
   1293 for k in list(self._plugin_class_registry.keys()):

File ~/software/strax/strax/context.py:1046, in Context.get_components(self, run_id, targets, save, time_range, chunk_number)
   1044 for d in plugins.values():
   1045     self._set_plugin_config(d, run_id, tolerant=False)
-> 1046     d.setup()
   1047 return strax.ProcessorComponents(
   1048     plugins=plugins,
   1049     loaders=loaders,
   1050     loader_plugins=loader_plugins,
   1051     savers=savers,
   1052     targets=strax.to_str_tuple(final_plugin))

File ~/software/fuse/fuse/plugins/detector_physics/electron_drift.py:159, in ElectronDrift.setup(self)
    157 #Can i do this scaling in the url config?
    158 if self.field_distortion_model == "inverse_fdc":
--> 159     self.fdc_map_fuse.scale_coordinates([1., 1., - self.drift_velocity_liquid])
    161 # Field dependencies 
    162 if any(self.enable_field_dependencies.values()):

File /opt/XENONnT/anaconda/envs/XENONnT_development/lib/python3.9/site-packages/straxen/itp_map.py:245, in InterpolatingMap.scale_coordinates(self, scaling_factor, map_name)
    243     return
    244 if hasattr(scaling_factor, '__len__'):
--> 245     assert (len(scaling_factor) == self.dimensions), \
    246         f"Scaling factor array dimension {len(scaling_factor)} " \
    247         f"does not match grid dimension {self.dimensions}"
    248     self._sf = scaling_factor
    249 if isinstance(scaling_factor, (int, float)):

AssertionError: Scaling factor array dimension 3 does not match grid dimension 2 ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant