Cadet Match simulation error

Hi, I am trying to estimate the model parameters using cadet-match. I am facing the attached error. For reference, I have attached my code. Kindly help me to solve the error.


Naveen J

Output exceeds the size limit. Open the full output data in a text editor
TypeError                                 Traceback (most recent call last)
Cell In[10], line 63
     60 match_file2 = os.fspath(match_config_file)
     62 with open(match_file2, 'w') as json_file:
---> 63     json.dump(match_config.to_dict(), json_file, indent='\t')
     65 match = Match(match_file2)
     66 match.start_sim()

File ~/opt/miniconda3/envs/ngj/lib/python3.9/json/, in dump(obj, fp, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
    173     iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
    174         check_circular=check_circular, allow_nan=allow_nan, indent=indent,
    175         separators=separators,
    176         default=default, sort_keys=sort_keys, **kw).iterencode(obj)
    177 # could accelerate with writelines in some versions of Python, at
    178 # a debuggability cost
--> 179 for chunk in iterable:
    180     fp.write(chunk)

File ~/opt/miniconda3/envs/ngj/lib/python3.9/json/, in _make_iterencode.<locals>._iterencode(o, _current_indent_level)
    429     yield from _iterencode_list(o, _current_indent_level)
    430 elif isinstance(o, dict):
--> 431     yield from _iterencode_dict(o, _current_indent_level)
    432 else:
    433     if markers is not None:
    178     """
--> 179     raise TypeError(f'Object of type {o.__class__.__name__} '
    180                     f'is not JSON serializable')

TypeError: Object of type PosixPath is not JSON serializable

parest.ipynb (26.9 KB)

A quick search in the forum gave me this:

Hope that helps. :slight_smile:

Thank you so much for your response. I have got the below error.

AttributeError                            Traceback (most recent call last)
Cell In[11], line 7
      4 base_dir = Path(r'/Users/naveenj/Documents/Code/Protein A modelling/New code')
      6 match_config = Dict()
----> 7 match_config.CADETPath = Cadet.cadet_path.as_posix()
      8 match_config.baseDir = base_dir.as_posix()
      9 match_config.resultsDir = 'results'

File ~/opt/miniconda3/envs/ngj/lib/python3.9/site-packages/cadet/, in CadetMeta.cadet_path(cls)
    132 @property
    133 def cadet_path(cls):
    134     if cls.cadet_runner is not None:
--> 135         return cls.cadet_runner.cadet_path

AttributeError: 'property' object has no attribute 'cadet_path'

Now I am facing the below error. Kindly help me to resolve this.

Thank you

Naveen J

ValueError                                Traceback (most recent call last)
ValueError: could not convert string to float: ''

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
Cell In[11], line 64
     61 with open(match_file, 'w') as json_file:
     62     json.dump(match_config.to_dict(), json_file, indent='\t')
---> 64 match = Match(match_file)
     65 match.start_sim()

File ~/opt/miniconda3/envs/ngj/lib/python3.9/site-packages/CADETMatch/, 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/miniconda3/envs/ngj/lib/python3.9/site-packages/CADETMatch/, 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()
    990     # string-length and datetime-unit discovery (like `arr.astype()`).
    991     # Due to chunking, certain error reports are less clear, currently.
    992     if filelike:

ValueError: could not convert string '\ufeff0' to float64 at row 0, column 1.

Can you please check the version of CADET-Python you have installed:

pip show cadet-python

This should show v0.14

To upgrade, use

pip install --upgrade cadet-python

Also, make sure that the old CADET-Python package is no longer installed in your environment. So

pip show cadet

Should return WARNING: Package(s) not found: cadet

Then restart the kernel and try again.

Thanks @j.schmoelder

I have tried that. Same issue. For reference, I have attached the code. I am using osx for running the cadet.


Naveen J

parest.ipynb (32.7 KB)

Please also provide the csv file s.t. I can run your example.

Sure. Thanks

langmuir_experiment.csv (163.6 KB)

ok, there seems to be an issue with the file format of your csv file. I’m not an expert on this topic. I fixed it by opening it in an editor and saving it again but your milage may vary. Please make sure that the csv file uses UTF-8, EOL etc.

langmuir_experiment.csv (163.6 KB)

Thanks a lot @j.schmoelder

The simulation started.

1 Like

Hello, J. Schmoelder

I was attempting to fit multiple experimental data sets in order to estimate parameters. However, the terminal became frozen, and the estimated parameter values are not producing satisfactory results.
Please assist me in solving this issue.

For your reference, I have attached my code here.

Thank you.
Naveen J


2023-03-02 22:05:56,978 search 133 ending coarse refine

2023-03-02 22:05:56,997 print_progress 68 Generation: 44 	Population: 1 	Meta: 1 	SSE: 5.351e-04 	RMSE: 1.956e-02

2023-03-02 22:06:00,801 print_progress 68 Generation: 45 	Population: 1 	Meta: 1 	SSE: 5.351e-04 	RMSE: 1.956e-02

2023-03-02 22:06:00,801 wait_sub 57 waiting for subprocess main for

parest_final-multiexp.ipynb (76.6 KB)