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%3EGrande%20image%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%3ELa%20matrice%20JSL%202D%20peut%20%C3%AAtre%20transform%C3%A9e%20en%20image%20%C3%A0%20l'aide%20de%20la%20fonction%20NewImage.%20Les%20matrices%20et%20images%202D%20utilisent%20beaucoup%20de%20m%C3%A9moire%20%3B%20vous%20pourrez%20peut-%C3%AAtre%20cr%C3%A9er%20une%20matrice%2030K%20x%2030K%20pleine%20de%20valeurs%20de%20couleur%20et%20l'afficher.%20Si%20vous%20souhaitez%20l'enregistrer%20en%20tant%20que%20fichier%20PNG%2C%20vous%20devrez%20peut-%C3%AAtre%20essayer%20une%20taille%20plus%20petite.%2020K%20x%2020K%20a%20fonctionn%C3%A9%20pour%20moi.%20Voici%20quelques%20JSL%20avec%20un%20commentaire%20sur%20la%20fa%C3%A7on%20dont%20vous%20pourriez%20%C3%A9viter%20d'avoir%20plusieurs%20copies%20de%20la%20matrice%20en%20m%C3%A9moire%20%C3%A0%20la%20fois.%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%3EIl%20y%20a%20deux%20choix%20avec%20NewImage%26nbsp%3B%3A%20une%20seule%20matrice%20contenant%20des%20couleurs%20RVB%20JSL%20ou%20trois%20matrices%20de%20valeurs%20r%2C%20g%20et%20b%20comprises%20entre%200%20et%201.%20Le%20JSL%20affich%C3%A9%20utilise%20le%20premier%20choix%20car%20une%20seule%20matrice%20doit%20exister.%20Le%20deuxi%C3%A8me%20choix%20est%20plus%20souple%20mais%20n%C3%A9cessitera%2C%20au%20moins%20pour%20un%20moment%2C%20quatre%20matrices%20pour%20exister.%3C%2FP%3E%3CP%3EL'image%20jointe%20fait%2020%20000%20x%2020%20000%20pixels%20%3B%20en%20fonction%20de%20votre%20visionneuse%2C%20vous%20voudrez%20faire%20d%C3%A9filer%20ou%20zoomer.%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%3EUne%20petite%20note%20sur%20la%20cr%C3%A9ation%20d'images%20%C3%A9normes%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