開發人員教學:JMP 18 中的新 Python 整合與腳本編寫功能影片包括參加 2024 年 3 月 21 日現場網路研討會的與會者的問答。時間為 25:36-50:39 和 01:00:21 下面提供了一些問答的摘要。如需完整答案,請考慮查看影片中的問答。
自動化和腳本編寫回覆:開發人員教學:JMP 18 中的新 Python 整合與腳本編寫功能我想澄清一下這個問題的回答:
Q:這是否意味著 JMP 無法使用其他版本的 Python?
JMP 18 將僅利用已安裝的嵌入式 Python 3.11。用於選擇 Python 安裝的 Python Init() 和 Python Connect() 參數均已棄用,並且這些參數被忽略。
JMP 18 的 Python 是一個隔離環境,因此它不會(不應該)與系統上的其他 Python 安裝發生衝突。沒有什麼可以阻止您利用現有的 Python 管道。您可以使用 JMP 的 Python 從 JMP 中獲取數據,然後將數據移交給現有的管道。
回覆:開發人員教學:JMP 18 中的新 Python 整合與腳本編寫功能
@gail_massari寫道:
Q:如果我想在不同的 Python 環境中從 jupyter Notebook 存取 JMP 資料表,「import 'JMP」指令仍然有效嗎?
答:沒有。
「相同的 Python 環境」怎麼樣 - 是否可以將 Spyder 或 Visual Studio 程式碼編輯器等 Python IDE 連結到 JMP Python 安裝?
擁有 IDE 的所有 Python 程式設計功能 + 能夠
import 'JMP'
回覆:開發人員教學:JMP 18 中的新 Python 整合與腳本編寫功能import jmp語句只能在 JMP 本身內部運作。
它不是作為共享庫或 Python 腳本實現的,從 Python 到 JMP 功能的橋樑是 JMP 可執行檔本身內部的 C++ 程式碼。
回覆:開發人員教學:JMP 18 中的新 Python 整合與腳本編寫功能將帶有圖像的表格傳送到 Python 時,是否可以從 Python 內部存取映像?
回覆:開發人員教學:JMP 18 中的新 Python 整合與腳本編寫功能# 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)
帶輸出:
新圖像(字元到 Blob(“1iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAYAAABxLuK ...
VORK5CYII=", "base64 壓縮" ), "png")
從 Python 端,您需要解析 Blob 字串、壓縮方法和格式,將圖像從文字解碼為二進位。
然而,另一種可能更好的方法是使用 << Get Pixels("rgba");在列上取得 4 個元素的矩陣列表,這是透過 Python Send() 支援的。
更新了 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)
回覆:開發人員教學:JMP 18 中的新 Python 整合與腳本編寫功能帖子的前幾行在某個地方被剪掉了。
不,不能直接使用 JMP 18 中的 Python 集成,但可以使用 JSL 進行解決。
JMP 18 的重點是字元和數字列。目前正在開發對數據表的全面支援。