Convert a chemkin input file to cantera format - matlab

I followed the Matlab Interface User’s Guide on website http://www.cantera.org/docs/sphinx/html/matlab/code-docs/utilities.html to convert a CHEMKIN input file to Cantera format,the steps are
adddir('the directory of chem.inp,therm.dat and tran.dat')
f = ck2cti('chem.inp', 'therm.dat', 'tran.dat')
but an error occurred.
************************************************
Cantera Error!
************************************************
Procedure: ck2cti
Error: Error converting input file "chem.inp" to CTI.
Python command was: 'C:\Python34\python.exe'
The exit code was: 7
-------------- start of converter log --------------
Traceback (most recent call last):
File "<stdin>", line 9, in <module>
File "C:\Python34\lib\site-packages\cantera\ck2cti.py", line 1899, in convertMech
raise IOError('Missing input file: {0!r}'.format(inputFile))
OSError: Missing input file: 'chem.inp'
--------------- end of converter log ---------------
error ck2cti (line 47)
iok = ctmethods(0, 1, infile, thermo, transport, idtag, 0, 0);
Is there a solution for the problem? any reply will be appreciated!!

Adddir is not a built-in matlab function, you should use addpath instead.
So it become:
addpath('the directory of chem.inp,therm.dat and tran.dat')
f = ck2cti('chem.inp', 'therm.dat', 'tran.dat')
Check also that your file 'chem.inp' exist and is placed in the right folder.

Related

Unable to convert Python to Window Based app .exe

I'm converting my Main.py python code to .exe application and I need to load ids.txt there are some values line by line, but after converting is done the Auto-py-to-exe-master free Github app says this error message:
Traceback (most recent call last):
File "main.py", line 37, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\janka\\AppData\\Local\\Temp\\_MEI200202\\base_library.zip\\ids.txt'
By the way my file location of ids.txt is called in other directory and from application path as follows:
with open(os.path.join(sys.path[0], "ids.txt"), "r") as f:
devIds = f.read().splitlines()

OSError: libDTKLPR5.so: cannot open shared object file: No such file or directory

enter image description heretrying to use cdll.LoadLibrary function in Python 3.11.0 in Ubuntu 22.04.1 LTS 64-bit.
Below error occured. If you have faced this kind of issue please help.
Traceback (most recent call last):
File "/home/*****/Desktop/python-camera-app-latest/radius-camera-app/main.py", line 10, in <module>
main()
File "/home/*****/Desktop/python-camera-app-latest/radius-camera-app/main.py", line 5, in main
handler = DTKVideoStreamHandler()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/*****/Desktop/python-camera-app-latest/radius-camera-app/Services/Implements/DTKVideoStreamHandler.py", line 28, in _init_
self.__DTKLPR = cdll.LoadLibrary(DTKLPR5Lib)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/_init_.py", line 454, in LoadLibrary
return self._dlltype(name)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/_init.py", line 376, in __init_
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: libDTKLPR5.so: cannot open shared object file: No such file or director
Thanks in advance...
In windows 10 64-bit. There is some kind of solution with using
os.add_dll_directory(full_path)
before calling
self.__DTKLPR = cdll.LoadLibrary(DTKLPR5Lib)
but this solution is not working in Ubuntu. Because add_dll_directory is supposed to only windows. (Based on information in its documentation)

Error encountered when using Autodock/Vina Plugin in PyMOL

I am a beginner to PyMOL and I am using it for my docking project. I have encountered errors using the Autodock/Vina plugin in PyMOL.
I was trying to carry out the set up for the grid and Error 1 occurred when I was clicking on the arrow that allows me to change the grid parameter x,y and z.
As for Error 2, it occurs when I tried to generate the receptor on the next page.
Under the log section, I also got a notice saying "Batch: prepare_receptor4.py -r C:\Users\User\Desktop\plugin-test\receptor.3ig7.pdb -o C:\Users\User\Desktop\plugin-test\receptor.3ig7.pdbqt -A checkhydrogen"
It would be appreciated if you would tell me what is missing or should be done to solve these errors.
I look forward to reading any of your replies and I thank you in advance,
Elayne
Error: 1
TypeError Exception in Tk callback
Function: <bound method Autodock.n_points_Y_changed of <pmg_tk.startup.autodock_plugin.Autodock object at 0x0000020649CD9388>> (type: <class 'method'>)
Args: ('scroll', '1', 'units')
Traceback (innermost last):
File "C:\Users\User\AppData\Local\Schrodinger\PyMOL2\lib\site-packages\Pmw.py", line 1823, in __call__
return self.func(*args)
TypeError: n_points_Y_changed() takes 2 positional arguments but 4 were given
Error: 2
FileNotFoundError Exception in Tk callback
Function: <bound method Autodock.generate_receptor of <pmg_tk.startup.autodock_plugin.Autodock object at 0x0000020649CD9388>> (type: <class 'method'>)
Args: ()
Traceback (innermost last):
File "C:\Users\User\AppData\Local\Schrodinger\PyMOL2\lib\site-packages\Pmw.py", line 1823, in __call__
return self.func(*args)
File "C:\Users\User\AppData\Local\Schrodinger\PyMOL2\lib\site-packages\pmg_tk\startup\autodock_plugin.py", line 1940, in generate_receptor
result, output = getstatusoutput(command)
File "C:\Users\User\AppData\Local\Schrodinger\PyMOL2\lib\site-packages\pmg_tk\startup\autodock_plugin.py", line 85, in getstatusoutput
p = Popen(args, stdout=PIPE, stderr=STDOUT, stdin=PIPE, env=env)
File "C:\Users\User\AppData\Local\Schrodinger\PyMOL2\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Users\User\AppData\Local\Schrodinger\PyMOL2\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
I'm also encountering the same issue on Windows, try running a linux distro on vmware and make sure to install Pymol with support for Python 2.7 because the script is not compatible with Python3.

PyPDF2 giving me an invalid argument error

I'm trying to parse text from pdf file. while I was doing tutorial of how to PyPDF2 I got the following error. I did the search for an answer but ended up finding none. Any Help will be greatly appreciated.
Traceback (most recent call last):
File "D:/text_recognizer/main.py", line 4, in <module>
inputStream = PyPDF2.PdfFileReader(input)
File "D:\KimKanna's Class\python27\lib\site-packages\PyPDF2\pdf.py", line 1084, in __init__
self.read(stream)
File "D:\KimKanna's Class\python27\lib\site-packages\PyPDF2\pdf.py", line 1689, in read
stream.seek(-1, 2)
IOError: [Errno 22] Invalid argument
here is fullcode
import PyPDF2
with open(".\\pdf\\test_sample.pdf","rb") as input:
inputStream = PyPDF2.PdfFileReader(input)
In my case the .pdf I wanted to open is empty and not closed from previous python code in powershell(cmd prompt). So, when I tried to delete those files it says 'Close the file and try again'. (that was my "AHaa" moment)
So I stopped the py.exe from my Windows task manager and deleted those empty, not closed files. Then I run the same code with another files, It worked fine.. :)

Unable to run pykalma example code that is reading MAT file with scipy

Below is the line of the code that pykalman example is using to load the matlab file robot.mat. However, it is throwing an error with message ValueError: Unknown mat file type, version 100, 110.
I am new to reading matlab files in Python. Can anyone help me understand exactly what version it is expecting and how to get around the issue?
data = io.loadmat(join(module_path, 'data', 'robot.mat'))
Traceback (most recent call last):
File "C:\ProgramData\Anaconda2\lib\site-
packages\IPython\core\interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-0439d709929f>", line 1, in <module>
data = load_robot()
File "C:\ProgramData\Anaconda2\lib\site-packages\pykalman\datasets\base.py",
line 45, in load_robot
data = io.loadmat(join(module_path, 'data', 'robot.mat'))
File "C:\ProgramData\Anaconda2\lib\site-packages\scipy\io\matlab\mio.py",
line 135, in loadmat
MR = mat_reader_factory(file_name, appendmat, **kwargs)
File "C:\ProgramData\Anaconda2\lib\site-packages\scipy\io\matlab\mio.py",
line 59, in mat_reader_factory
mjv, mnv = get_matfile_version(byte_stream)
File "C:\ProgramData\Anaconda2\lib\site-
packages\scipy\io\matlab\miobase.py",
line 241, in get_matfile_version
raise ValueError('Unknown mat file type, version %s, %s' % ret)
ValueError: Unknown mat file type, version 100, 110
I'm guessing here (and adding one more idea to hpaulj's good overview):
First i checked the file manually and opening in an editor reads as:
MATLAB 5.0 MAT-file, Platform: MACI64, Created on: Tue Jun 26 00:59:04 2012
...
Therefore there should be no problem in regards to scipy (if the mat-file is actually following this "header").
Now it seems there are some open issues with that project with the most relevant beeing:
Unable to load robot.mat #59
(Don't be surprised too much with the different eror-values as i would expect possibly indeterministic stuff like that when bad IO is beeing done)
and: pykalman/datasets/ not copied when pykalman is installed with pip #66
So it seems this dataset does not come with pip-install automatically, which looks like your problem and should be easily handled (manually obtaining the data!). It is also compatible with hpaulj's wondering about that strange error (one could argue if there is no better error-handling possible).