Cadet Match smoothing error


when using real data, Cadet-Match stops while smoothing the data, giving me a type error:

~\Anaconda3\lib\site-packages\CADETMatch\ in record_smoothing(s, s_knots, crit_fs, crit_fs_der, knots, all_s, name, cache)
    281     if name not in data.root:
    282         data.root[name].knots = knots
--> 283         data.root[name].all_s = all_s
    284         data.root[name].s = float(s)
    285         data.root[name].s_knots = int(s_knots)

TypeError: float() argument must be a string or a number, not 'NoneType'

error.txt (3.1 KB)

data_breakthrough.csv (1.5 MB)
breakthrough.json (1.1 KB)
create_model.ipynb (4.8 KB)
match_breakthrough.ipynb (18.9 KB)

Thanks a lot for all your help.


I need to look at this dataset for a bit. The newest version of CADETMatch runs it without an error but it also doesn’t smooth it very well so I need to figure that out.

Sorry, this has taken a while to figure out. I have improved the smoothing code to work on this kind of problem also and I have put the data from this into my test code for smoothing.

The smoothing code was actually running into a problem related to the very high sample rate compared to the duration and a few other small things.

If you update to CADETMatch 0.7.1 (available with conda or pip) it should fully resolve this issue.

There are a few other issues I find when fixing this related to the model.

If you want to match to data breakthrough the last time point in the data needs to match the last section_time. One thing to consider is that when matching to experimental data the simulation runs at all the points you have data for and in your case there are about 79K data points which also slows the process down. You might want to downsample the data before matching if this turns out to be a problem. I may even add a method to CADETMatch to allow it to do this in the future.

model.root.input.model.unit_001.adsorption.mcl_qmax = q_max   should be
model.root.input.model.unit_001.adsorption.mcl_qmax = [q_max]  

We are currently working on an interface that will make it easier to build these models and validate that all the parameters are setup correctly.

For the matching I have also made a few changes

parameter1 = Dict()
parameter1.location = '/input/model/unit_001/COL_DISPERSION'
parameter1.min = 1e-12
parameter1.max = 1e-6
parameter1.component = -1
parameter1.bound = -1
parameter1.transform = 'auto'

parameter2 = Dict()
parameter2.location = '/input/model/unit_001/FILM_DIFFUSION'
parameter2.min = 1e-12
parameter2.max = 1e-6
parameter2.component = 0
parameter2.bound = -1

parameter2.transform = 'auto'
parameter3 = Dict()
parameter3.location = '/input/model/unit_001/adsorption/MCL_QMAX'
parameter3.min = 5
parameter3.max = 40
parameter3.component = 0
parameter3.bound = -1
parameter3.transform = 'auto'

For your problem I also suggest changing to ShapeFront. It is designed specifically for when you only have the front side of a peak.

feature1 = Dict() = "Breakthrough"
feature1.type = 'ShapeFront'
feature1.decay = 1

Please let me know if you run into any problems or need more help

1 Like


thanks for all effort, much appreciated.

I will take a closer look the next days and let you know if I run into any issues. Thank you also for clarifying a few things.