Entwickler-Tutorial: Neue Python-Integrations- und Skriptfunktionen in JMP 18Dieses Video enthält Fragen und Antworten von Teilnehmern, die am Live-Webinar am 21. März 2024 teilgenommen haben. Zeit: 25:36–50:39 Uhr und 01:00:21 Uhr. Nachfolgend finden Sie eine Zusammenfassung einiger Fragen und Antworten. Für eine vollständige Antwort schauen Sie sich bitte die Fragen und Antworten im Video an.
Automatisierung und SkripterstellungBetreff: Entwickler-Tutorial: Neue Python-Integrations- und Skriptfunktionen in JMP 18Ich möchte die Antwort auf die Frage klarstellen:
F: Bedeutet das, dass JMP keine anderen Versionen von Python verwenden kann?
JMP 18 nutzt nur das installierte eingebettete Python 3.11. Die Parameter „Python Init()“ und „Python Connect()“ zur Auswahl einer Python-Installation sind alle veraltet und die Parameter werden ignoriert.
Python von JMP 18 ist eine isolierte Umgebung und sollte daher nicht mit anderen Python-Installationen auf Ihrem System in Konflikt geraten ( sollten) . Nichts hindert Sie daran, Ihre bestehende Python-Pipeline zu nutzen . Sie können JMPs Python verwenden, um Daten von und zu JMP zu übertragen und diese an Ihre bestehende Pipeline weiterzuleiten.
Betreff: Entwickler-Tutorial: Neue Python-Integrations- und Skriptfunktionen in JMP 18
@gail_massari schrieb:
F: Wenn ich über ein Jupyter-Notebook in einer anderen Python-Umgebung auf eine JMP-Datentabelle zugreifen möchte, funktioniert die Anweisung „JMP importieren“ trotzdem?
A: Nein.
Wie wäre es mit einer „gleichen Python-Umgebung“ – ist es möglich, Python-IDEs wie Spyder oder Visual Studio Code Editors mit der JMP-Python-Installation zu verknüpfen?
Um alle Python-Programmierfunktionen der IDEs + die Möglichkeit dazu zu haben
import 'JMP'
Betreff: Entwickler-Tutorial: Neue Python-Integrations- und Skriptfunktionen in JMP 18Die import jmp- Anweisung funktioniert nur innerhalb von JMP selbst.
Es ist nicht als gemeinsam genutzte Bibliothek oder Python-Skript implementiert. Die Brücke von Python zur JMP-Funktionalität ist C++-Code, der in der ausführbaren JMP-Datei selbst enthalten ist.
Betreff: Entwickler-Tutorial: Neue Python-Integrations- und Skriptfunktionen in JMP 18Ist es beim Senden von Tabellen mit Bildern an Python möglich, aus Python heraus auf die Bilder zuzugreifen?
Re: Developer Tutorial: New Python Integration and Scripting Capabilities in JMP 18# getColImage.py
#
# Description:
# Get a picture from an image column using Python
# JMP 18 only supports numeric and character column types for transfer
# but the value can be grabbed via JSL, and passed to Python as a string
# in the meantime. The Python code will need to trim off the
# New Image( Char To Blob()) and decode the image back to binary.
import jmp
dt = jmp.open(jmp.SAMPLE_DATA + 'Big Class Families.jmp')
jmp.run_jsl('''
Names Default to Here(1);
dt = Current Data Table();
img = dt:picture[1]; // get the picture
img_str = char(img); // make it a string
Python Send(img_str); // send Python the string
''')
# print the object's JSL representation
# which is text encoding of the binary, a description of the
# encoding and image format type.
print(img_str)
With output:
New Image(Char To Blob( "1iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAYAAABxLuK ...
VORK5CYII=", "base64compressed" ), "png")
From the Python side you need to parse out the Blob string, compression method, and format, decode the image from text to binary.
However, an alternate and likely better way is to use << Get Pixels("rgba"); on the column to get a 4 element list of matrices which is supported via Python Send().
Updated getColImage.py
# getColImage.py
#
# Description:
# Get a picture from an image column using Python
# JMP 18 only supports numeric and character column types for transfer
# but the value can be grabbed via JSL, and passed to Python as a string
# in the meantime. The Python code will need to trim off the
# New Image( Char To Blob()) and decode the image back to binary.
#
# Alternatively use << Get Pixels("rgba"); to get a list of matricies
# which is passable from JSL to Python using Python Send();
#
import jmp
dt = jmp.open(jmp.SAMPLE_DATA + 'Big Class Families.jmp')
jmp.run_jsl('''
Names Default to Here(1);
dt = Current Data Table();
img = dt:picture[1]; // get the picture
img_str = char(img); // make it a string
Python Send(img_str); // send Python the string
asRGBA = { r, g, b, a} = dt:picture[1] << Get Pixels("rgba");
Python Send(asRGBA);
''')
# print the object's JSL representation
# which is text encoding of the binary, a description of the
# encoding and image format type.
print(img_str)
print(asRGBA)
Re: Developer Tutorial: New Python Integration and Scripting Capabilities in JMP 18Somewhere the first few lines of the post got clipped.
No, not directly possible using the Python Integration in JMP 18, but a work around is possible using JSL.
The focus on JMP 18 was character and numeric columns. Full support of the data table is current ongoing development.