CADET-Match error when running simulation file from CADET-Process

Hello, I wanted to to use CADET-Match for parameter estimation using a simulation file from CADET-Process. It is a simple setup comprising of an inlet, column and an outlet. The h5 file was obtained first:

process_simulator.run(process, cadet=None, file_path='cal1.h5')

The jupyter notebook for the CADET-Match is adopted from the CADET-tutorial notebook. When I try to run it, the following error appears:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [11], in <module>
      9 with open(match_config_file.as_posix(), 'w') as json_file:
     10     json.dump(match_config.to_dict(), json_file, indent='\t')
---> 12 match = Match(match_config_file)
     13 match.start_sim()

File /opt/conda/lib/python3.8/site-packages/CADETMatch/jupyter.py:19, in Match.__init__(self, json_path)
     17 self.cache.setup_dir(json_path)
     18 CADETMatch.match.createDirectories(self.cache, json_path)
---> 19 self.cache.setup(json_path)

File /opt/conda/lib/python3.8/site-packages/CADETMatch/cache.py:147, in Cache.setup(self, json_path, load_plugins)
    142 self.parameters = [
    143     self.transforms[parameter["transform"]](parameter, self)
    144     for parameter in self.settings["parameters"]
    145 ]
    146 self.setupHeaders()
--> 147 self.setupTarget()
    148 self.setupMinMax()
    150 self.WORST = [self.badScore] * self.numGoalsOrig

File /opt/conda/lib/python3.8/site-packages/CADETMatch/cache.py:424, in Cache.setupTarget(self)
    421 self.adaptive = True
    423 for experiment in self.settings["experiments"]:
--> 424     self.target[experiment["name"]] = self.setupExperiment(experiment)
    425 if "errorModel" in self.settings:
    426     self.add_units_error_model(self.settings["errorModel"], self.target)

File /opt/conda/lib/python3.8/site-packages/CADETMatch/cache.py:447, in Cache.setupExperiment(self, experiment, sim, dataFromSim)
    444 conn = sim.root.input.model.connections.switch_000.connections
    446 conn = numpy.array(conn)
--> 447 conn = numpy.reshape(conn, [-1, self.connectionNumberEntries])
    449 # find all the entries that connect to the column
    450 filter = conn[:, 1] == residence_time_unit

File <__array_function__ internals>:180, in reshape(*args, **kwargs)

File ~/.local/lib/python3.8/site-packages/numpy/core/fromnumeric.py:298, in reshape(a, newshape, order)
    198 @array_function_dispatch(_reshape_dispatcher)
    199 def reshape(a, newshape, order='C'):
    200     """
    201     Gives a new shape to an array without changing its data.
    202 
   (...)
    296            [5, 6]])
    297     """
--> 298     return _wrapfunc(a, 'reshape', newshape, order=order)

File ~/.local/lib/python3.8/site-packages/numpy/core/fromnumeric.py:57, in _wrapfunc(obj, method, *args, **kwds)
     54     return _wrapit(obj, method, *args, **kwds)
     56 try:
---> 57     return bound(*args, **kwds)
     58 except TypeError:
     59     # A TypeError occurs if the object does have such a method in its
     60     # class, but its signature is not identical to that of NumPy's. This
   (...)
     64     # Call _wrapit from within the except clause to ensure a potential
     65     # exception has a traceback chain.
     66     return _wrapit(obj, method, *args, **kwds)

ValueError: cannot reshape array of size 16 into shape (5)

Which is apparently due to an error when reshaping the connections array?
I do not really understand what is going on, so any help would be appreciated.
Thank you in advance.

CADET-Match-cal1.ipynb (14.2 KB)

Does your cal1.h5 file simulate if you just run it directly with cadet-cli? Also can you share your cal1.json file so we can see what you are trying to modify in the file to optimize?

Hi William

Thanks for reaching out. I think we can call this case closed since I have changed over to CADET from CADET-Process and now the .h5 file works flawlessly with CADET-Match.