The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Python
 NLFit error with python code sample

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ThemannJ Posted - 11/02/2023 : 11:18:26 AM
Origin Ver. 2021 (64-bit) and Service Release (Select Help-->About Origin): 9.8.0.200
Operating System: Windows 10 Pro

Hello,
When I'm trying to excecute the batch fitting example provided by Origin (first example at https://www.originlab.com/doc/en/python/Examples/Analysis) I get the following Error:

Traceback (most recent call last):
File "C:\ProgramData\OriginLab\98\PyPackage\Py3\originpro\analysis.py", line 21, in __init__
self._trfdf = ET.fromstring(po.LT_get_str(f'GetFDFAsXML("{self.func}")$'))
File "C:\Program Files\OriginLab\Origin2021\Python38.zip\xml\etree\ElementTree.py", line 1321, in XML
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

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

Traceback (most recent call last):
File "<string>", line 6, in <module>
File "C:\Users\Phd02\Documents\OriginLab\Anwenderdateien\batchfittingexample.py", line 30, in <module>
model = op.NLFit('Gaussian')
File "C:\ProgramData\OriginLab\98\PyPackage\Py3\originpro\analysis.py", line 23, in __init__
raise ValueError(f'Invalid fitting function: {func}') from e
ValueError: Invalid fitting function: Gaussian

It seems to me that the Programm can't find the fdf file, but i could'nt find a solution to the Problem.

Edit: the same sample code worked on a different PC. So the Problem turned out to be an installation issue. Upgrading Origin, repairing files and a complete reinstallation did not solve the issue on the first PC though. Any help would still be appreciated.

Thanks for any help in advance.
4   L A T E S T    R E P L I E S    (Newest First)
ThemannJ Posted - 11/03/2023 : 3:07:59 PM
Hello Chao,

you were right. I could upgrade to ver. 2021b which resolved my issue. Thank you!
ChaoC Posted - 11/03/2023 : 1:42:24 PM
Hello,

I'm thinking this may be an issue specific to 2021. Is the other computer also 2021?

If not, are you able to upgrade your Origin?

Best,
Chao
ThemannJ Posted - 11/03/2023 : 09:28:45 AM
Hello,

the Gaussian.fdf file is present in my directory. I also tried to change to different fdf files/fit methods in that same directory with possible case sensitivity in mind.
I also tried to place the Gaussian.fdf file into the directory .../Samples/Batch2 as well as where the .py file is located.
ChaoC Posted - 11/03/2023 : 09:15:27 AM
Hello,

It seems you may be missing the Gaussian.fdf file from C:\Program Files\OriginLab\Origin2021\FitFunc\Gaussian.fdf.

You could try copying the Gaussian.fdf from the working computer to the first PC.

Best,
Chao

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000