開発者チュートリアル: JMP 18 の新しい Python 統合とスクリプト機能このビデオには、2024 年 3 月 21 日のライブ ウェビナーに参加した参加者からの Q&A が含まれています。時間は 25:36 ~ 50:39 および 01:00:21 です。Q&A の一部の概要を以下に示します。完全な答えについては、ビデオ内の Q&A を確認してください。
自動化とスクリプト作成Re: 開発者チュートリアル: JMP 18 の新しい Python 統合とスクリプト機能質問に対する答えを明確にしたいと思います。
Q:これは、JMP では他のバージョンの Python を使用できないということですか?
JMP 18 は、インストールされた組み込み Python 3.11 のみを利用します。 Python インストールを選択するための Python Init() および Python Connect() パラメータはすべて非推奨となり、パラメータは無視されます。
JMP 18 の Python は分離された環境であるため、システム上の他の Python インストールと競合しません (競合すべきではありません) 。既存の Python パイプラインの利用を妨げるものは何もありません。 JMP の Python を使用して JMP との間でデータを取得し、既存のパイプラインに渡すことができます。
Re: 開発者チュートリアル: JMP 18 の新しい Python 統合とスクリプト機能
@gail_massari はこう書きました:
Q: 別の Python 環境の jupyter ノートブックから JMP データ テーブルにアクセスしたい場合でも、「import 'JMP」命令は機能しますか?
A: いいえ。
「同じ Python 環境」についてはどうでしょうか。Spyder や Visual Studio Code Editor などの Python IDE を JMP Python インストールにリンクすることは可能ですか?
IDE のすべての Python プログラミング機能と、
import 'JMP'
Re: 開発者チュートリアル: JMP 18 の新しい Python 統合とスクリプト機能import jmpステートメントは、JMP 自体からのみ機能します。
これは共有ライブラリまたは Python スクリプトとして実装されず、Python から JMP 機能へのブリッジは JMP 実行可能ファイル自体の内部にある C++ コードです。
Re: 開発者向けチュートリアル: JMP 18 の新しい Python 統合とスクリプト機能画像付きのテーブルを Python に送信する場合、Python 内から画像にアクセスすることはできますか?
Re: 開発者向けチュートリアル: 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)
出力:
新しい画像(Char To Blob( "1iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAYAAABxLuK ...
VORK5CYII=", "base64compressed" )、"png")
Python 側では、Blob 文字列、圧縮方法、形式を解析し、画像をテキストからバイナリにデコードする必要があります。
ただし、別の、おそらくより良い方法は、列で << Get Pixels("rgba"); を使用して、Python Send() でサポートされている 4 要素の行列リストを取得することです。
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: 開発者向けチュートリアル: JMP 18 の新しい Python 統合とスクリプト機能どこかで投稿の最初の数行が切り取られてしまいました。
いいえ、JMP 18 の Python 統合を使用して直接実行することはできませんが、JSL を使用して回避することは可能です。
JMP 18 では、文字と数値の列に重点が置かれました。データ テーブルの完全なサポートは現在開発中です。