Probe Software Users Forum

Software => DTSA II => Topic started by: Clueless Micky on October 24, 2025, 10:47:35 AM

Title: How to use the library EPQDatabase.Session
Post by: Clueless Micky on October 24, 2025, 10:47:35 AM
Hello all,

I'm trying to find my way into using scripts in DTSA-II, but I'm encountering issues that I couldn't solve despite extensive searching.

Specifically, I would like to use functions from the library EPQDatabase.Session, but I seem to be doing something wrong when calling the functions, they all result in an error about a wrong number of arguments provided.

Example:
import gov.nist.microanalysis.EPQDatabase.Session as session
session.getDetectors()

Result:
TypeError: getDetectors(): expected 1-2 args; got 0

I looked at the library's source code here:
https://github.com/usnistgov/EPQ/blob/master/src/gov/nist/microanalysis/EPQDatabase/Session.java (https://github.com/usnistgov/EPQ/blob/master/src/gov/nist/microanalysis/EPQDatabase/Session.java)

and to my understanding, getDetectors() should not expect an argument.

If you see what I'm getting wrong, please tell me.

In case anyone is wondering why I want to use this specific library: while getting to know the DTSA-II GUI, I added some detectors, but now I cannot delete them any more because the GUI does not seem to have that function. The library EPQDatabase.Session has a function deleteDetector() that presumably can do just that, but even with the simplest functions of that library I ran into the problem described above.

Many thanks for your help!
Title: Re: How to use the library EPQDatabase.Session
Post by: Nicholas Ritchie on October 25, 2025, 03:18:29 PM
I'll get back to you on this. :)  Probably Monday?
Title: Re: How to use the library EPQDatabase.Session
Post by: Clueless Micky on October 27, 2025, 10:21:29 AM
Concerning the issue of how to delete a detector definition, which motivated my question above, I found the solution in the "mt4_example.zip" file (https://www.cstl.nist.gov/div837/837.02/epq/dtsa2/mt4_example.zip) available on the DTSA-II homepage.

How to dispatch a detector for good:
det = Database.findDetector('Bye_bye_detector')
di=Database.findDetector(det.getDetectorProperties())
Database.deleteDetector(di)

It wasn't necessary to import any libraries.

As for the specific "TypeError" problem I encountered when trying to use functions from the library EPQDatabase.Session, I will still be interested in learning how to address the issue, in case I will need this library in a different context, or if the same problem may arise with other libraries.
Title: Re: How to use the library EPQDatabase.Session
Post by: Clueless Micky on October 28, 2025, 03:58:06 AM
Okay, I think I figured out how to use the library EPQDatabase.Session

It seems that all functions in this library expect "Database" as the first argument.
Accordingly, the example given in my original post should be corrected to:

import gov.nist.microanalysis.EPQDatabase.Session as session
session.getDetectors(Database)

which produces the expected result:
[Det_A, Det_B, Si(Li)]

An even easier solution comes with the realization that "Database" seems to be a synonym for "EPQDatabase.Session", so the above code can be simplified to:

Database.getDetectors()

and the other functions in the library EPQDatabase.Session can be accessed in an analogous manner.
Title: Re: How to use the library EPQDatabase.Session
Post by: Nicholas Ritchie on October 29, 2025, 07:52:53 AM
Sounds like you've made good progress.