cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-417795%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3E%E5%A4%A7%E5%9C%96%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-417795%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%20NewImage%20%E5%87%BD%E6%95%B8%E5%B0%87%20JSL%20%E4%BA%8C%E7%B6%AD%E7%9F%A9%E9%99%A3%E8%BD%89%E6%8F%9B%E7%82%BA%E5%9C%96%E5%83%8F%E3%80%82%20%E4%BA%8C%E7%B6%AD%E7%9F%A9%E9%99%A3%E5%92%8C%E5%9C%96%E5%83%8F%E4%BD%94%E7%94%A8%E5%A4%A7%E9%87%8F%E5%85%A7%E5%AD%98%EF%BC%9B%E6%82%A8%E4%B9%9F%E8%A8%B1%E5%8F%AF%E4%BB%A5%E8%A3%BD%E4%BD%9C%E4%B8%80%E5%80%8B%E5%85%85%E6%BB%BF%E9%A1%8F%E8%89%B2%E5%80%BC%E7%9A%84%2030K%20x%2030K%20%E7%9F%A9%E9%99%A3%E4%B8%A6%E9%A1%AF%E7%A4%BA%E5%AE%83%E3%80%82%20%E5%A6%82%E6%9E%9C%E8%A6%81%E5%B0%87%E5%85%B6%E5%8F%A6%E5%AD%98%E7%82%BA%20PNG%20%E6%96%87%E4%BB%B6%EF%BC%8C%E5%8F%AF%E8%83%BD%E9%9C%80%E8%A6%81%E5%98%97%E8%A9%A6%E4%BD%BF%E7%94%A8%E8%BC%83%E5%B0%8F%E7%9A%84%E5%B0%BA%E5%AF%B8%EF%BC%9B%2020K%20x%2020K%20%E5%B0%8D%E6%88%91%E6%9C%89%E7%94%A8%E3%80%82%20Here's%20some%20JSL%20with%20a%20comment%20%E9%97%9C%E6%96%BC%E5%A6%82%E4%BD%95%E9%81%BF%E5%85%8D%E5%9C%A8%E5%85%A7%E5%AD%98%E4%B8%AD%E5%90%8C%E6%99%82%E6%93%81%E6%9C%89%E7%9F%A9%E9%99%A3%E7%9A%84%E5%A4%9A%E5%80%8B%E5%89%AF%E6%9C%AC%E3%80%82%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Eclear%20globals()%3B%0A%0A%2F%2F%20notes%20on%20making%20big%20images%0A%2F%2F%0A%2F%2F%20a%2020Kx20K%20matrix%20is%2020000*20000*8%2F1024%2F1024%2F1024%20%3D%203GB%0A%2F%2F%20the%20image%20created%20from%20it%20will%20be%20at%20least%20half%20that%20size%20too%2C%20in%20memory.%0A%2F%2F%20clear%20globals%2C%20above%2C%20makes%20sure%20old%20matrices%20are%20released%2C%20otherwise%0A%2F%2F%20m%3DJ(...)%20might%20have%20the%20old%20matrix%20in%20m%20on%20the%20left%20hand%20side%20while%20the%0A%2F%2F%20new%20matrix%20is%20being%20created%20on%20the%20right%20hand%20side.%20Two%20copies%20at%20once.%0A%2F%2F%20the%20parallel%20assign%20below%20is%20designed%20to%20do%20all%20the%20processing%20on%20an%20element.%0A%2F%2F%20using%20m%20%3D%20f(m)%20later%20creates%20extra%20copies%2C%20and%20single-threaded.%20The%0A%2F%2F%20commented-out%20range(m)%20was%20from%20previous%20runs%20to%20figure%20out%20the%0A%2F%2F%20-1.1%20and%20%2F1.5%20scaling%20on%20the%20mandelbrot%20results.%20The%20critical%0A%2F%2F%20part%20is%20making%20the%20RGB%20color%20from%20f1(m)%2C%20f2(m)%2C%20f3(m)%20inside%20the%0A%2F%2F%20parallel%20assign.%20Otherwise%20there%20could%20be%20four!%20copies%20of%20m%20if%0A%2F%2F%20newimage(%22rgb%22%2C%20%7Bf1(m)%2C%20f2(m)%2C%20f3(m)%7D)%0A%2F%2F%20---%0A%2F%2F%20the%20above%20was%20important%20for%20a%2030Kx30K%20matrix%2C%20using%20~7GB%3B%20my%20machine%0A%2F%2F%20could%20not%20hold%20~28GB%20at%20once.%20But%20I%20had%20to%20reduce%20it%20to%2020K%20anyway%20to%0A%2F%2F%20save%20the%20picture%3B%20somewhere%20bigger%20than%2020K%20refuses%20to%20save%20the%20image.%0A%0Am%20%3D%20J(%2020000%2C%2020000%2C%20.%20)%3B%0AParallel%20Assign(%20%7B%7D%2C%20m%5Br(%20-1.5%2C%201.5%20)%2C%20c(%20-2.25%2C%200.75%20)%5D%20%3D%20%2F%2F%0A%20(%2F%2F%0A%20%20x%20%3D%20((Mandelbrot(%2010000%2C%200%2C%20c%2C%20r%20)%20%5E%20.1)%20-%201.1)%20%2F%201.5%20%3B%20%2F%2F%20scaled%20counts%0A%20%20RGB%20Color(%20(x)%20%5E%20.5%2C%20(x)%20%5E%209%2C%20(1%20-%20x)%20%5E%209%20)%20%3B%20%2F%2F%20keep%20final%20color%0A%20)%20%20%2F%2F%0A)%3B%0A%2F%2FShow(%20Range(%20m%20)%20)%3B%20%2F%2F%20m%20holds%20JSL%20colors%20not%20mandelbrot%20counts.%20range%20is%20meaningless%0Am%3Dnewimage(m)%3B%0A%0ANew%20Window(%20%22m%22%2C%20m%20)%3B%0Am%26lt%3B%3CSAVEPICTURE%3E%3C%2FSAVEPICTURE%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3ENewImage%20%E6%9C%89%E5%85%A9%E7%A8%AE%E9%81%B8%E6%93%87%EF%BC%9A%E5%8C%85%E5%90%AB%20JSL%20rgb%20%E9%A1%8F%E8%89%B2%E7%9A%84%E5%96%AE%E5%80%8B%E7%9F%A9%E9%99%A3%EF%BC%8C%E6%88%96%20r%E3%80%81g%20%E5%92%8C%20b%20%E5%80%BC%E4%BB%8B%E6%96%BC%200%20%E5%92%8C%201%20%E4%B9%8B%E9%96%93%E7%9A%84%E4%B8%89%E5%80%8B%E7%9F%A9%E9%99%A3%E3%80%82%20%E9%A1%AF%E7%A4%BA%E7%9A%84%20JSL%20%E4%BD%BF%E7%94%A8%E7%AC%AC%E4%B8%80%E5%80%8B%E9%81%B8%E9%A0%85%EF%BC%8C%E5%9B%A0%E7%82%BA%E5%8F%AA%E9%9C%80%E8%A6%81%E5%AD%98%E5%9C%A8%E4%B8%80%E5%80%8B%E7%9F%A9%E9%99%A3%E3%80%82%20%E7%AC%AC%E4%BA%8C%E7%A8%AE%E9%81%B8%E6%93%87%E6%9B%B4%E9%9D%88%E6%B4%BB%EF%BC%8C%E4%BD%86%E8%87%B3%E5%B0%91%E6%9A%AB%E6%99%82%E9%9C%80%E8%A6%81%E5%9B%9B%E5%80%8B%E7%9F%A9%E9%99%A3%E3%80%82%3C%2FP%3E%3CP%3E%E6%89%80%E9%99%84%E5%9C%96%E7%89%87%E7%82%BA20%2C000%20x%2020%2C000%E5%83%8F%E7%B4%A0%EF%BC%9B%E6%A0%B9%E6%93%9A%E6%82%A8%E7%9A%84%E6%9F%A5%E7%9C%8B%E5%99%A8%EF%BC%8C%E6%82%A8%E9%9C%80%E8%A6%81%E6%BB%BE%E5%8B%95%E6%88%96%E7%B8%AE%E6%94%BE%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-417795%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22notSoBig.png%22%20style%3D%22width%3A%20833px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22notSoBig.png%22%20style%3D%22width%3A%20833px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22notSoBig.png%22%20style%3D%22width%3A%20833px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22notSoBig.png%22%20style%3D%22width%3A%20833px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22notSoBig.png%22%20style%3D%22width%3A%20833px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F35750iB7ADA542BAD0C525%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22notSoBig.png%22%20alt%3D%22notSoBig.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E9%97%9C%E6%96%BC%E5%89%B5%E5%BB%BA%E5%A4%A7%E5%9C%96%E5%83%8F%E7%9A%84%E5%B0%8F%E7%AD%86%E8%A8%98%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Choose Language Hide Translation Bar
Craige_Hales
Super User
Big Picture

The JSL 2D matrix can be turned into an image using the NewImage function. 2D matrices and images use a lot of memory; you might be able to make a 30K x 30K matrix full of color values and display it. If you want to save it as a PNG file, you might need to try a smaller size; 20K x 20K worked for me. Here's some JSL with a comment about how you might avoid having multiple copies of the matrix in memory at once.

clear globals();

// notes on making big images
//
// a 20Kx20K matrix is 20000*20000*8/1024/1024/1024 = 3GB
// the image created from it will be at least half that size too, in memory.
// clear globals, above, makes sure old matrices are released, otherwise
// m=J(...) might have the old matrix in m on the left hand side while the
// new matrix is being created on the right hand side. Two copies at once.
// the parallel assign below is designed to do all the processing on an element.
// using m = f(m) later creates extra copies, and single-threaded. The
// commented-out range(m) was from previous runs to figure out the
// -1.1 and /1.5 scaling on the mandelbrot results. The critical
// part is making the RGB color from f1(m), f2(m), f3(m) inside the
// parallel assign. Otherwise there could be four! copies of m if
// newimage("rgb", {f1(m), f2(m), f3(m)})
// ---
// the above was important for a 30Kx30K matrix, using ~7GB; my machine
// could not hold ~28GB at once. But I had to reduce it to 20K anyway to
// save the picture; somewhere bigger than 20K refuses to save the image.

m = J( 20000, 20000, . );
Parallel Assign( {}, m[r( -1.5, 1.5 ), c( -2.25, 0.75 )] = //
	(//
		x = ((Mandelbrot( 10000, 0, c, r ) ^ .1) - 1.1) / 1.5 ; // scaled counts
		RGB Color( (x) ^ .5, (x) ^ 9, (1 - x) ^ 9 ) ; // keep final color
	)  //
);
//Show( Range( m ) ); // m holds JSL colors not mandelbrot counts. range is meaningless
m=newimage(m);

New Window( "m", m );
m<<savepicture("$desktop/mandelbrot.png","png");

There are two choices with NewImage: a single matrix containing JSL rgb colors, or three matrices of r, g, and b values between 0 and 1. The JSL shown uses the first choice because only one matrix needs to exist. The second choice is more flexible but will require, at least for a moment, four matrices to exist.

The attached picture is 20,000 by 20,000 pixels; depending on your viewer you'll want to scroll or zoom.

Last Modified: Sep 13, 2021 11:45 AM