<commit_before>#pragma rtGlobals=1		// Use modern global access method.

#include ":fc-analysis-scripts"

Function absrelheights(img, bheights, added, nobrushrel, nobrushabs)
	String img, bheights, added, nobrushrel, nobrushabs

	// Create "absolute brush heights" wave
	WAVE imgw = $img
	WAVE bheightsw = $bheights
	Duplicate/O imgw, $added
	WAVE addedw = $added
	addedw += bheightsw
	
	// Display "absolute brush heights" image graph
	String name = MakeGraphName("heightsabs")
	Display/N=$name
	Appendimage addedw
	ModifyImage $added ctab={*,*,Gold,0}
	ModifyGraph width=300,height=300, margin(right)=90
	ColorScale/C/N=scale/F=0/A=RC/X=-28 image=$added, "absolute brush height (nm)"
	PutDFNameOnGraph()
	DoUpdate
	
	scatterplots(img, bheights, added, nobrushrel, nobrushabs)
End


Function scatterplots(img, bheights, added, nobrushrel, nobrushabs)
	String img, bheights, added, nobrushrel, nobrushabs
	
	WAVE imgw = $img
	WAVE bheightsw = $bheights
	WAVE addedw = $added
	
	String graphname = ""
	
	// Create relative "zero brush height" line (y = -x)
	Make/N=10/O $nobrushrel
	WAVE nobrushrelw = $nobrushrel
	WaveStats/Q imgw
	SetScale/I x, V_min, V_max, nobrushrelw
	nobrushrelw = -x
	
	// Display scatterplot relative brush heights
	graphname = "scatter_rel"
	Display/N=$graphname bheightsw vs imgw
	ModifyGraph marker=19,msize=1.5,rgb=(0,0,0),mode=3
	AppendToGraph nobrushrelw
	SetAxis/A
	SetAxis/A/E=1 left
	ModifyGraph standoff(bottom)=0,zero(left)=1
	Label left "brush height (nm)"
	Label bottom "feature depth (nm)"
	Tag/C/N=surface/AO=1/X=0/Y=-5/B=1/G=(65280,0,0)/F=0/L=0 $nobrushrel, ((V_min+V_max)/2), "gold surface"
	PutDFNameOnGraph()
	DoUpdate
	
	// Create absolute "zero brush height" line (y=x)
	Make/N=10/O $nobrushabs
	WAVE nobrushabsw = $nobrushabs
	SetScale/I x, V_min, V_max, nobrushabsw
	nobrushabsw = x
	
	// Display scatterplot absolute brush heights
	graphname = "scatter_abs"
	Display/N=$graphname addedw vs imgw
	ModifyGraph marker=19,msize=1.5,rgb=(0,0,0),mode=3
	AppendToGraph nobrushabsw
	SetAxis/A
	ModifyGraph standoff(bottom)=0
	Label left "absolute brush height (nm)\r(feature depth + brush height)"
	Label bottom "feature depth (nm)"
	ModifyGraph lblMargin(left)=10
	ModifyGraph zero=1
	Tag/C/N=hardwall/AO=1/X=0/Y=-5/B=1/G=(65280,0,0)/F=0/L=0 $nobrushabs, ((V_min+V_max)/2), "hardwall"
	Tag/C/N=surface/O=0/X=7/Y=.5/B=1/G=(0,0,0)/F=0/L=0 left, 0, "gold surface"
	PutDFNameOnGraph()
	DoUpdate
End

Function plot_color(hole, edge, top, textpos)
	Variable hole, edge, top		// X coords where the region ends (upper edge)
	Variable textpos					// Where region text gets placed vertically (y-axis value)
	
	// Draw colors on background
	SetDrawLayer/K UserBack
	SetDrawEnv save, xcoord=bottom, ycoord=prel, linethick=0, fillpat=1<commit_msg>Scatterplots: make "absolute brush height" optional by passing empty arg<commit_after>#pragma rtGlobals=1		// Use modern global access method.

#include ":fc-analysis-scripts"

Function absrelheights(img, bheights, added, nobrushrel, nobrushabs)
	String img, bheights, added, nobrushrel, nobrushabs

	// Create "absolute brush heights" wave
	WAVE imgw = $img
	WAVE bheightsw = $bheights
	Duplicate/O imgw, $added
	WAVE addedw = $added
	addedw += bheightsw
	
	// Display "absolute brush heights" image graph
	String name = MakeGraphName("heightsabs")
	Display/N=$name
	Appendimage addedw
	ModifyImage $added ctab={*,*,Gold,0}
	ModifyGraph width=300,height=300, margin(right)=90
	ColorScale/C/N=scale/F=0/A=RC/X=-28 image=$added, "absolute brush height (nm)"
	PutDFNameOnGraph()
	DoUpdate
	
	scatterplots(img, bheights, added, nobrushrel, nobrushabs)
End


Function scatterplots(img, bheights, added, nobrushrel, nobrushabs)
	String img, bheights, added, nobrushrel, nobrushabs
	
	Variable doabs = 1
	if (cmpstr(added, "") == 0)
		// skip absolute brush height
		doabs = 0
	endif
	
	WAVE imgw = $img
	WAVE bheightsw = $bheights
	
	if (doabs)
		WAVE addedw = $added
	endif
	
	String graphname = ""
	
	// Create relative "zero brush height" line (y = -x)
	Make/N=10/O $nobrushrel
	WAVE nobrushrelw = $nobrushrel
	WaveStats/Q imgw
	SetScale/I x, V_min, V_max, nobrushrelw
	nobrushrelw = -x
	
	// Display scatterplot relative brush heights
	graphname = "scatter_rel"
	Display/N=$graphname bheightsw vs imgw
	ModifyGraph marker=19,msize=1.5,rgb=(0,0,0),mode=3
	AppendToGraph nobrushrelw
	SetAxis/A
	SetAxis/A/E=1 left
	ModifyGraph standoff(bottom)=0,zero(left)=1
	Label left "brush height (nm)"
	Label bottom "feature depth (nm)"
	Tag/C/N=surface/AO=1/X=0/Y=-5/B=1/G=(65280,0,0)/F=0/L=0 $nobrushrel, ((V_min+V_max)/2), "gold surface"
	PutDFNameOnGraph()
	DoUpdate
	
	if (doabs)
		// Create absolute "zero brush height" line (y=x)
		Make/N=10/O $nobrushabs
		WAVE nobrushabsw = $nobrushabs
		SetScale/I x, V_min, V_max, nobrushabsw
		nobrushabsw = x
		
		// Display scatterplot absolute brush heights
		graphname = "scatter_abs"
		Display/N=$graphname addedw vs imgw
		ModifyGraph marker=19,msize=1.5,rgb=(0,0,0),mode=3
		AppendToGraph nobrushabsw
		SetAxis/A
		ModifyGraph standoff(bottom)=0
		Label left "absolute brush height (nm)\r(feature depth + brush height)"
		Label bottom "feature depth (nm)"
		ModifyGraph lblMargin(left)=10
		ModifyGraph zero=1
		Tag/C/N=hardwall/AO=1/X=0/Y=-5/B=1/G=(65280,0,0)/F=0/L=0 $nobrushabs, ((V_min+V_max)/2), "hardwall"
		Tag/C/N=surface/O=0/X=7/Y=.5/B=1/G=(0,0,0)/F=0/L=0 left, 0, "gold surface"
		PutDFNameOnGraph()
		DoUpdate
	endif
End

Function plot_color(hole, edge, top, textpos)
	Variable hole, edge, top		// X coords where the region ends (upper edge)
	Variable textpos					// Where region text gets placed vertically (y-axis value)
	
	// Draw colors on background
	SetDrawLayer/K UserBack
	SetDrawEnv save, xcoord=bottom, ycoord=prel, linethick=0, fillpat=1
{'fraction_non_alphanumeric': 0.12541139788671402, 'fraction_numerical': 0.02823488654079335, 'mean_word_length': 4.745273631840796, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3244590', 'n_tokens_mistral': 2387, 'n_tokens_neox': 2218, 'n_words': 547}