There are some lines near the beginning of simulate_pixels.py that are called during single module MC, namely lines 360-386. By default for a module0 simulation the pixel_layout and response_file parameters are strings as opposed to lists so for instance len(pixel_layout) will yield the total number of characters, not the expected length of 1. This is an issue due to the or n_modules == 1 that causes the len part of the if statement to run even if the argument is not a list. Also, len(pixel_thresholds_file) and len(pixel_gains_file) automatically gets an error because these parameters are None by default, which have no length. So I had to comment out all the lines below and I could continue to the simulation without a problem. Are these lines necessary? If not I suggest removing them but if so we need to fix the if statements to account for the occurrences of strings and Nones.
(I think @YifanC worked on the new configuration method and would be the one to ask about this?)
if not mod2mod_variation:
# Check if the configrations are consistent
# Allow configuration to be provided as a string or a single element list
if (isinstance(pixel_layout, list) or n_modules == 1) and len(pixel_layout) > 1:
raise KeyError("Provided more than one pixel layout file for the simulation with no module variation.")
elif isinstance(pixel_layout, list) and len(pixel_layout) == 1:
pixel_layout = pixel_layout[0]
if (isinstance(response_file, list) or n_modules == 1) and len(response_file) > 1:
raise KeyError("Provided more than one response file for the simulation with no module variation.")
elif isinstance(response_file, list) and len(response_file) == 1:
response_file = response_file[0]
if (isinstance(pixel_thresholds_file, list) or n_modules == 1) and len(pixel_thresholds_file) > 1:
raise KeyError("Provided more than one pixel threshold file for the simulation with no module variation.")
elif isinstance(pixel_thresholds_file, list) and len(pixel_thresholds_file) == 1:
pixel_thresholds_file = pixel_thresholds_file[0]
if (isinstance(pixel_gains_file, list) or n_modules == 1) and len(pixel_gains_file) > 1:
raise KeyError("Provided more than one pixel gain file for the simulation with no module variation.")
elif isinstance(pixel_gains_file, list) and len(pixel_gains_file) == 1:
pixel_gains_file = pixel_gains_file[0]
if (isinstance(light_lut_filename, list) or n_modules == 1) and len(light_lut_filename) > 1:
raise KeyError("Provided more than one light lookup table for the simulation with no module variation.")
elif isinstance(light_lut_filename, list) and len(light_lut_filename) == 1:
light_lut_filename = light_lut_filename[0]```
Thank you for reporting the issue and sorry for the obvious mistake. Could you please check the latest commit 0919093 in develop and see if it solves the problem
There are some lines near the beginning of simulate_pixels.py that are called during single module MC, namely lines 360-386. By default for a module0 simulation the pixel_layout and response_file parameters are strings as opposed to lists so for instance len(pixel_layout) will yield the total number of characters, not the expected length of 1. This is an issue due to the
or n_modules == 1
that causes the len part of the if statement to run even if the argument is not a list. Also,len(pixel_thresholds_file)
andlen(pixel_gains_file)
automatically gets an error because these parameters are None by default, which have no length. So I had to comment out all the lines below and I could continue to the simulation without a problem. Are these lines necessary? If not I suggest removing them but if so we need to fix the if statements to account for the occurrences of strings and Nones.(I think @YifanC worked on the new configuration method and would be the one to ask about this?)