<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Scripters Club Recording: Running Python Code within JSL in JMP Scripters Club Discussions</title>
    <link>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767284#M146</link>
    <description>&lt;P&gt;great presentation, thanks for preparing the stuff and sharing!&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jun 2024 10:42:35 GMT</pubDate>
    <dc:creator>Georg</dc:creator>
    <dc:date>2024-06-20T10:42:35Z</dc:date>
    <item>
      <title>Scripters Club Recording: Running Python Code within JSL</title>
      <link>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767254#M144</link>
      <description>&lt;P&gt;Presenters:&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2742"&gt;@martindemel&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may also want to watch the recording from West Coast Scripter's Club session on Python integration in JMP 18&lt;A href="https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Recording-is-now-available-from-the-May-3rd-JSL-JMP-Scripter-s/m-p/760186#M141" target="_blank" rel="noopener"&gt;&amp;nbsp;from Paul Nelson&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-6355352227112w960h540r659" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6355352227112" data-account="6058004218001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6058004218001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-6355352227112w960h540r659');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://community.jmp.com/t5/video/gallerypage/video-id/6355352227112"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 12:10:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767254#M144</guid>
      <dc:creator>maria_astals</dc:creator>
      <dc:date>2024-06-20T12:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Scripters Club Recording: Running Python Code within JSL</title>
      <link>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767282#M145</link>
      <description>&lt;P&gt;Another dizzying session - so many more amazing things to learn!&lt;/P&gt;&lt;P&gt;Will the script that&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;used for the on screen demos be shared?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 10:31:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767282#M145</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2024-06-20T10:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Scripters Club Recording: Running Python Code within JSL</title>
      <link>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767284#M146</link>
      <description>&lt;P&gt;great presentation, thanks for preparing the stuff and sharing!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 10:42:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767284#M146</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2024-06-20T10:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Scripters Club Recording: Running Python Code within JSL</title>
      <link>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767298#M147</link>
      <description>&lt;P&gt;yes, Jarmo will add the files here soon&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 12:02:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767298#M147</guid>
      <dc:creator>martindemel</dc:creator>
      <dc:date>2024-06-20T12:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Scripters Club Recording: Running Python Code within JSL</title>
      <link>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767360#M148</link>
      <description>&lt;P&gt;I have attached the files I used in my part of the session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition I have added code for my dark theme I use for JMP's Python Script Editor. If you wish to use it be sure to understand how those themes work, I haven't had any issues (yet), this is old wish list item so I'm not sure if all the comments are relevant anymore &lt;A href="https://community.jmp.com/t5/JMP-Wish-List/JSL-Text-Editor-Color-Themes/idi-p/56203/page/2" target="_blank"&gt;https://community.jmp.com/t5/JMP-Wish-List/JSL-Text-Editor-Color-Themes/idi-p/56203/page/2&lt;/A&gt;. The "theme" is controlled&amp;nbsp; by&amp;nbsp;&lt;EM&gt;JMPStyles.PFS&lt;/EM&gt; file found from C:\Users\&amp;lt;username&amp;gt;\AppData\Roaming\JMP\JMP\18 (for windows)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1718879116015.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65446i4680E5AF6F07DAF0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1718879116015.png" alt="jthi_1-1718879116015.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Example of the theme:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1718879010166.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65445iBF9BBD6ECB6ED8C4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1718879010166.png" alt="jthi_0-1718879010166.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Copy paste the theme from here and save it as JMPStyles.PFS (JMP Community doesn't support uploading .PFS files)&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//*** Generated Text, Editing this incorrectly may risk not being able to start JMP ***
Styles(
	Dark(
		Python(
			Default Enabled(
				Foreground Color({248, 248, 242}),
				Background Color({12, 16, 33})
			),
			Default Disabled(),
			Comment(
				Foreground Color({117, 113, 94})
			),
			Comment Blocks(
				Foreground Color({117, 113, 94})
			),
			Number(
				Foreground Color({230, 219, 116})
			),
			String(
				Foreground Color({230, 219, 116})
			),
			Decorators(
				Foreground Color({230, 219, 116})
			),
			Quoted string(
				Foreground Color({230, 219, 116})
			),
			Triple Quotes(
				Foreground Color({230, 219, 116})
			),
			Triple Double Quotes(
				Foreground Color({230, 219, 116})
			),
			Keyword(
				Foreground Color({78, 201, 176})
			),
			Identifiers(
				Foreground Color({220, 220, 220})
			),
			Operators(
				Foreground Color({220, 220, 220})
			),
			Line Number(
				Foreground Color({220, 220, 220}),
				Background Color({12, 16, 33})
			),
			EOL(
				Foreground Color({220, 220, 220}),
				Background Color({12, 16, 33})
			),
			Brace Light(
				Foreground Color({204, 221, 255}),
				Background Color({14, 69, 131})
			),
			Bad Brace(
				Background Color({107, 4, 3}),
				Foreground Color({221, 221, 221})
			)
		)
	)
)


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Few comments of my examples&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The HDBSCAN demo&lt;/STRONG&gt; I did does require JMP Pro due to using JMP's Multivariate Embedding platform.&lt;/P&gt;
&lt;P&gt;Orange parts are for JMP and blue for Python&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1718879272327.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65447i3DEBBAF12ED153E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1718879272327.png" alt="jthi_2-1718879272327.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I'm mostly getting started with the Python integration in JMP so my Python code definitely isn't the cleanest one, but for a quick example it should be good to go.&lt;/P&gt;
&lt;P&gt;I use Python Send() to send variables to Python side&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Python Send(dt);&lt;BR /&gt;Python Send(cluster_cols);&lt;BR /&gt;Python Send(clustersize);&lt;BR /&gt;Python Send(samples);&lt;BR /&gt;Python Send(epsilon);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then Python Submit() to run the code below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;import hdbscan
import jmp
import numpy as np
import pandas as pd

df = pd.DataFrame()
for colname in cluster_cols:
	df[colname] = np.array(dt[colname])

clusterer = hdbscan.HDBSCAN(min_cluster_size=int(clustersize), min_samples=int(samples), cluster_selection_epsilon=epsilon)
cluster_labels = clusterer.fit_predict(df)

df['Clusters'] = cluster_labels
col = dt.new_column("CLUSTERS", jmp.DataType.Numeric, jmp.ModelingType.Nominal)
dt[col.name] = list(df.iloc[:,2])
new_col = col.name

del df&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The example first runs dimension reduction (tsne or umap), hdbscan on created two columns, displays graph, sets table script to re-create plot, groups columns and sets HDBSCAN parameters to CLUSTERS note column properties&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_3-1718888978759.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65464i34D23BC992FE2614/image-size/large?v=v2&amp;amp;px=999" role="button" title="jthi_3-1718888978759.png" alt="jthi_3-1718888978759.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Python Get Graphics() has been deprecated you have to figure out other ways to &lt;STRONG&gt;get images from Python to JMP.&lt;/STRONG&gt; JMP's example show how you can do it by first saving the image and then using JMP's Open() to load the image to JMP. I did demonstrate how you can use python modules io and base64 to load the image to JMP&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

Python Submit("\[
import base64
import io
import matplotlib.pyplot as plt

plt.clf()
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.draw()

my_iobytes = io.BytesIO()
plt.savefig(my_iobytes, format='png', bbox_inches='tight')
my_iobytes.seek(0)
base64data = base64.b64encode(my_iobytes.read()).decode()
]\");

img = Open(Char To Blob(Python Get(base64data), "base64"), "png");
nw = New Window("test", img);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally I want to note that there are many ways to perform the transformation between pandas dataframe and JMP datatable. You can for example do "direct" transform using .csv files, use list(df.iloc[:,2]) or df[col].values.tolist(). There are examples of all of these and I haven't yet made my self familiar with the different methods to be able to make recommendations what you should use.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 13:42:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767360#M148</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-20T13:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Scripters Club Recording: Running Python Code within JSL</title>
      <link>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767361#M149</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/15435"&gt;@Ressel&lt;/a&gt; just added the files!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 13:42:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/JMP-Scripters-Club-Discussions/Scripters-Club-Recording-Running-Python-Code-within-JSL/m-p/767361#M149</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-20T13:42:27Z</dc:date>
    </item>
  </channel>
</rss>

