<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel rdf:about="https://community.wolfram.com">
    <title>Community RSS Feed</title>
    <link>https://community.wolfram.com</link>
    <description>RSS Feed for Wolfram Community showing any discussions tagged with Packages sorted by most viewed.</description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1108337" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2141352" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/787142" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3118205" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2330900" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1321057" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/214901" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1715017" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/984003" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1807709" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1170226" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/560469" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1484511" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1646303" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1655203" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1527021" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1736686" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1039591" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/963158" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1468475" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1108337">
    <title>Set up a package with Needs[]?</title>
    <link>https://community.wolfram.com/groups/-/m/t/1108337</link>
    <description>By steps Insert/FilePath, I got a file path:&#xD;
&amp;#034;D:\\Mathematica\\Mathematica Programer II\\MATHPROG\\LOGICPROGRAMMING.M&amp;#034;,&#xD;
but &#xD;
&#xD;
    Needs[&amp;#034;D:\\Mathematica\\Mathematica Programer \&#xD;
    II\\MATHPROG`LOGICPROGRAMMING.m`&amp;#034;]&#xD;
&#xD;
&#xD;
Mathematica always says &#xD;
&#xD;
        Needs::cxt: Invalid context specified at position 1 in&#xD;
     Needs[D:\Mathematica\Mathematica Programer II\MATHPROG`LOGICPROGRAMMING.m` ]. &#xD;
    A context must consist of valid symbol names separated ` &#xD;
&#xD;
In fact I put `, What&amp;#039;s wrong?</description>
    <dc:creator>Math Logic</dc:creator>
    <dc:date>2017-05-26T03:00:05Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2141352">
    <title>CUDA not working on Mathematica 12.2</title>
    <link>https://community.wolfram.com/groups/-/m/t/2141352</link>
    <description>Hello all :)&#xD;
CUDA is not working on 12.2.&#xD;
Look at this:&#xD;
What I am supposed to do?&#xD;
I also tried by downloading the CUDA packlets: change nothing.&#xD;
I have an NVIDIA RTX 3090 and the drivers are ok.&#xD;
Thank you foe helping me.&#xD;
Regards to all,&#xD;
&#xD;
Jean-Michel</description>
    <dc:creator>Jean-Michel Collard</dc:creator>
    <dc:date>2020-12-18T02:04:15Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/787142">
    <title>Crystallica: A package to plot crystal structures</title>
    <link>https://community.wolfram.com/groups/-/m/t/787142</link>
    <description>## General information and download links ##&#xD;
&#xD;
If you&amp;#039;re interested in crystal structures, you can now download the Crystallica application from the Wolfram Library Archive, and then you can do things like this:&#xD;
&#xD;
    Needs[&amp;#034;Crystallica`&amp;#034;];&#xD;
    CrystalPlot[&#xD;
    {{5.4,0,0},{0,5.4,0},{0,0,5.4}},&#xD;
    {{0,0,0},{0,0,.5},{0,.5,0},{.5,0,0},{.24,.24,.24},{.24,.76,.76},{.76,.24,.76},{.76,.76,.24}},&#xD;
    {1,2,2,2,3,3,3,3},&#xD;
    AtomCol-&amp;gt;{&amp;#034;Firebrick&amp;#034;,&amp;#034;YellowGreen&amp;#034;,White},AtomRad-&amp;gt;.4,&#xD;
    BondStyle-&amp;gt;2,BondDist-&amp;gt;3,&#xD;
    CellLineStyle-&amp;gt;False,AddQ-&amp;gt;True,Lighting-&amp;gt;{{&amp;#034;Directional&amp;#034;,White,ImageScaled[{0,0,1}]}},Background-&amp;gt;Black]&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
Here are the download links for Crystallica and two other packages you may need:&#xD;
&#xD;
[Crystallica][2] - contains the functions `CrystalPlot` and `CrystalChange`&#xD;
&#xD;
[CifImport][3] - contains an import function for CIF files&#xD;
&#xD;
[VaspImport][4] - contains an import function for files related to [VASP][5]&#xD;
&#xD;
Once you&amp;#039;ve installed Crystallica (by saving the entire Crystallica folder - not the zip archive - to `$USerBaseDirectory/Applications` and re-starting the Kernel), you can enter Crystallica into the Documentation Center and you&amp;#039;ll find lots of useful examples. Most of the examples in this post are taken from the Documentation. For the other two packages, just install them and evaluate this:&#xD;
&#xD;
    ?CifImport&#xD;
    ?VaspImport&#xD;
&#xD;
I&amp;#039;ll first show you a few things the `CrystalPlot` function can do when you already have crystal structure data inside Mathematica, wherever it may have come from. Then we&amp;#039;ll take a look at how to get the data into Mathematica in the first place, which is where `CifImport` and `VaspImport` will come into play - but we&amp;#039;ll get data from other sources as well. I&amp;#039;ll cover the different import solutions in separate replies to this thread, because I have a feeling that I&amp;#039;ll be rambling on and on and on...&#xD;
&#xD;
## Simple plot ##&#xD;
&#xD;
Traditional ball-and-stick plots are usually just fine, so the simplest thing you can do is this:&#xD;
&#xD;
    CrystalPlot[&#xD;
    {{4.5,0,0},{0,4.5,0},{0,0,3}},&#xD;
    {{0,0,0},{.5,.5,.5},{.2,.8,.5},{.3,.3,0},{.7,.7,0},{.8,.2,.5}},&#xD;
    {1,1,2,2,2,2}]&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
As you can see, `CrystalPlot` expects three arguments. The first one contains the lattice vectors, which are simply the three vectors that create the parallelepiped that constitutes the cell. The second argument contains the atomic coordinates, but they&amp;#039;re given in the basis of the lattice vectors (which is quite useful in crystallography). The third argument is a list of integers that gives the atom types, with one entry for each atom. If you want to plot a molecule instead, you can call `CrystalPlot` with just two arguments: A list of atom coordinates in cartesian space, and a list of atom types. Everything else you see in the plot - the atoms, bonds, colours, arrows etc. - represents the default settings of various layout options.&#xD;
&#xD;
## Advanced atoms and bonds ##&#xD;
&#xD;
Let&amp;#039;s take a look at some more advanced options just for fun. For instance, atoms and bonds can look any way you need them to, because you can specify your own functions for them. You can also fine-tune where to put bonds and what to do with their thickness and colour in a physically (or chemically) meaningful way, but I won&amp;#039;t show that here. So here are some customized atoms and bonds:&#xD;
&#xD;
    Row[Table[&#xD;
    CrystalPlot[{{4,0,0},{0,4,0},{0,0,4}},{{0,0,0},{.4,.4,.4},{.8,.8,.8}},{1,2,3},&#xD;
    AtomRad-&amp;gt;{.4,1.2,.7},AtomFunction-&amp;gt;style,ImageSize-&amp;gt;400],&#xD;
    {style,{&#xD;
    (Ball[#1,#2]&amp;amp;),&#xD;
    (Scale[Sphere[#1,#2],{1,1,.5}]&amp;amp;),&#xD;
    ({EdgeForm[Thick],Opacity[.7],Cuboid[#1-.5*#2,#1+.5*#2]}&amp;amp;)&#xD;
    }}]]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
    Row[Table[&#xD;
    CrystalPlot[{{0,0,0},{5,0,0},{2.5,4,0}},{1,2,3},BondDist-&amp;gt;6,BondStyle-&amp;gt;style,ImageSize-&amp;gt;400],&#xD;
    {style,{&#xD;
    1,&#xD;
    Function[{bonds,partcol},Table[{If[ii&amp;lt;.5,partcol[#,1],partcol[#,2]],Sphere[bonds[[#,1]]+ii*(bonds[[#,2]]-bonds[[#,1]]),.15]},{ii,0,1,1/9}]&amp;amp;/@Range[Length[bonds]]],&#xD;
    Function[{bonds,partcol},Module[{spiral,points,rad=.05},&#xD;
    spiral[atoms_]:=Module[{scale=.5,dist=atoms[[2]]-atoms[[1]],curls=60,normal,rot,scaled},&#xD;
    normal=Table[{scale*Cos[ii],scale*Sin[ii],.1*ii},{ii,0,curls,\[Pi]/10}];&#xD;
    scaled={#[[1]],#[[2]],10*Norm[dist]/curls*#[[3]]}&amp;amp;/@normal;&#xD;
    rot=scaled.Quiet[RotationMatrix[{dist,{0,0,1}}]];&#xD;
    Join[{atoms[[1]]},#+atoms[[1]]&amp;amp;/@(rot[[25;;-25]]),{atoms[[2]]}]];&#xD;
    points=spiral/@bonds;&#xD;
    {partcol[#,1],Tube[BSplineCurve[points[[#,;;Round[Length[points[[#]]]/2]]],rad]],partcol[#,2],Tube[BSplineCurve[points[[#,Round[Length[points[[#]]]/2];;]],rad]]}&amp;amp;/@Range[Length[bonds]]&#xD;
    ]]&#xD;
    }}]]&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
## Lattice planes ##&#xD;
&#xD;
Crystallica can also add lattice planes to the plot. You can specify them using [h,k,l] Miller indices and distance to the origin.&#xD;
&#xD;
    CrystalPlot[{{3,0,0},{0,3,0},{0,0,3}},{{0,0,0}},{1},&#xD;
    AddQ-&amp;gt;True,AtomRad-&amp;gt;.3,AtomCol-&amp;gt;&amp;#034;CadmiumYellow&amp;#034;,Sysdim-&amp;gt;2,CellLineStyle-&amp;gt;2,&#xD;
    LatticePlanes-&amp;gt;Table[{{1,1,1},dist},{dist,1,5}],ContourStyle-&amp;gt;{&amp;#034;TerreVerte&amp;#034;,Opacity[.7]},BoundaryStyle-&amp;gt;Thick]&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
## Coordination polyhedra ##&#xD;
&#xD;
You can automatically search for and plot coordination polyhedra. This is not limited to the commonly occurring tetrahedra and octahedra - you can actually look for polyhedra with arbitrary numbers of corners. There are also options to fine-tune both the searching and the rendering.&#xD;
&#xD;
    plot[corners_,mixed_]:=CrystalPlot[{{0,0,0},{0,0,1.8},{-.9,-1.5,-.6},{-.9,1.5,-.6},{1.7,0,-.6},{.8,.8,.8}},{1,2,2,2,2,3},&#xD;
    BondStyle-&amp;gt;False,ImageSize-&amp;gt;250,&#xD;
    PolyMode[corners]-&amp;gt;{&amp;#034;Show&amp;#034;-&amp;gt;All,&amp;#034;AllowMixed&amp;#034;-&amp;gt;mixed},PolyStyle[corners]-&amp;gt;Directive[Opacity[.5],EdgeForm[Thick]]];&#xD;
    Grid[{{&#xD;
    &amp;#034;&amp;#034;,&#xD;
    &amp;#034;Search for polyhedra with \n4 corners&amp;#034;,&#xD;
    &amp;#034;Search for polyhedra with \n5 corners&amp;#034;&#xD;
    },{&#xD;
    &amp;#034;Allow \nmixed corners&amp;#034;,&#xD;
    plot[4,True],&#xD;
    plot[5,True]&#xD;
    },{&#xD;
    &amp;#034;Don&amp;#039;t allow \nmixed corners&amp;#034;,&#xD;
    plot[4,False],&#xD;
    plot[5,False]&#xD;
    }},Dividers-&amp;gt;All]&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
    CrystalPlot[{{2.5,-4.3,0},{2.5,4.3,0},{0,0,5.5}},&#xD;
    {{.5,0,0},{0,.5,.7},{.5,.5,.3},{.2,.4,.5},{.6,.8,.2},{.2,.8,.8},{.8,.6,.5},{.4,.2,.2},{.8,.2,.8}},{1,1,1,2,2,2,2,2,2},&#xD;
    PolyMode[4]-&amp;gt;True,PolyStyle[4]-&amp;gt;EdgeForm[None],AddQ-&amp;gt;True,&#xD;
    Sysdim-&amp;gt;2,AtomRad-&amp;gt;0,CellLineStyle-&amp;gt;False,AtomCol-&amp;gt;{&amp;#034;SlateGray&amp;#034;,&amp;#034;Firebrick&amp;#034;},&#xD;
    ViewAngle-&amp;gt;.4,ViewPoint-&amp;gt;{3.2,0,1.1},ViewVertical-&amp;gt;{.5,0,1.2}]&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
## Other things ##&#xD;
&#xD;
Visualization aside, you can also build supercells, change cell shapes, or add, remove and sort atoms... but that&amp;#039;s a bit boring to read, so I&amp;#039;ll refer you to the Documentation page of the `CrystalChange` function instead.&#xD;
&#xD;
If you&amp;#039;re interested, we can use this thread to talk about any questions you may have, or you can share your use of the package (if you decide to use it). I&amp;#039;m not offering full support here, but I&amp;#039;ll be floating around, and I&amp;#039;d like to hear your feedback. We don&amp;#039;t have any intentions to be involved in further development. But if you have a good idea and some time, then by all means, work on it for yourself, or host it on your favourite code collaboration site.&#xD;
&#xD;
Bianca Eifert and Christian Heiliger&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=teaser.png&amp;amp;userId=69107&#xD;
  [2]: http://library.wolfram.com/infocenter/MathSource/9372/&#xD;
  [3]: http://library.wolfram.com/infocenter/MathSource/9373/&#xD;
  [4]: http://library.wolfram.com/infocenter/MathSource/9375/&#xD;
  [5]: http://vasp.at/&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=9692simple.png&amp;amp;userId=69107&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=atoms.png&amp;amp;userId=69107&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=bonds.png&amp;amp;userId=69107&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=planes.png&amp;amp;userId=69107&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=polys.png&amp;amp;userId=69107&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=polys2.png&amp;amp;userId=69107&#xD;
  [12]: http://rruff.geo.arizona.edu/AMS/CIF_text_files/13532_cif.txt&#xD;
  [13]: http://cms.mpi.univie.ac.at/vasp/vasp/POSCAR_file.html&#xD;
  [14]: http://wiki.jmol.org/index.php/File:Caffeine.mol</description>
    <dc:creator>Bianca Eifert</dc:creator>
    <dc:date>2016-02-05T18:43:18Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3118205">
    <title>Wolfram quantum framework: tensor networks, spiders, and ZX formalism</title>
    <link>https://community.wolfram.com/groups/-/m/t/3118205</link>
    <description>![enter image description here][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=heroimage.png&amp;amp;userId=1539902&#xD;
  [2]: https://www.wolframcloud.com/obj/5b3b5265-f1e2-406c-aef4-45a5f9ec363b</description>
    <dc:creator>Mohammad Bahrami</dc:creator>
    <dc:date>2024-02-07T19:21:52Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2330900">
    <title>[WSG21] Daily Study Group: programming tutorials</title>
    <link>https://community.wolfram.com/groups/-/m/t/2330900</link>
    <description>Daily Study Groups are back, now providing expertise on practical programming! After a short break, we&amp;#039;re starting up with a series that picks up where Wolfram Language Basics sessions ended. This 3-week series will take you from basic programming concepts to package development. &#xD;
&#xD;
Need tips on improving your code’s speed or functionality? Programming Tutorials offer a great opportunity to level-up your skills while interacting with software development professionals. See hands-on examples and get questions answered by Wolfram Language experts. Plus: participants who pass weekly quizzes are awarded a program completion certificate. Level 1 certification is available for those who pass manually graded exercises. &#xD;
&#xD;
Join us any time between August 2 and August 20! Check out our [registration page][1] for more details.&#xD;
&#xD;
&#xD;
&#xD;
 [1]: https://wolfr.am/Study_Group15</description>
    <dc:creator>Wolfram U</dc:creator>
    <dc:date>2021-07-30T15:24:02Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1321057">
    <title>Has Wolfram abandoned the Graphs and Networks functionality?</title>
    <link>https://community.wolfram.com/groups/-/m/t/1321057</link>
    <description>This is a cautionary tale for those who choose Mathematica as the main tool for their work.&#xD;
&#xD;
It is now clear to me that Wolfram has simply abandoned the [Graphs and Networks](http://reference.wolfram.com/language/guide/GraphsAndNetworks.html) functionality area and I am left high and dry. I have no recourse because Mathematica is closed source so there is only so much a user can do to fix or work around problems. Reporting bugs in this particular area has now clearly proven to be useless. Most simply do not get fixed, no matter how serious they are, or how great a hindrance they are to practical use. No new functionality has been added since version 10.0.  My colleagues who use other tools (mostly Python and R packages) are more productive at this point, but I have a handicap with those systems because I made the mistake of investing most of my time into Mathematica, and stayed optimistic about it even in the face of the most obvious warning signs.&#xD;
&#xD;
I am writing this post because those people who have not heavily invested in Mathematica, and in particular this functionality area of Mathematica, are not in a position to see this and may fall in the same trap I did.  What if the same thing happens to the functionality area that is critical to *your* work?&#xD;
&#xD;
Wolfram Research, of course, will not tell you that they gave up on `Graph`.  Thus, after my experience, I think I owe it to the community to warn you about the situation.&#xD;
&#xD;
----&#xD;
&#xD;
Some might ask me what specifically is wrong. I have made many posts on this forum about `Graph`-bugs (you only have to search), and I reported many more to WRI.  There is always a last strawit would be pointless to show it. Those who know me will know that I am not writing this admittedly emotional post out of ill will towards WRI. I have betted on Mathematica more than most, and have been advocating for it throughout the years. I even have a network analysis package with ~250 functions. If I am forced to abandon Mathematica for this type of work, then the countless hours that went into this package will all have been in vain.&#xD;
&#xD;
I admit that I am writing this public post partly out of desperation to try to get WRI to either fix the many serious `Graph`-problems, or otherwise publicly state that `Graph` is now abandoned so those of us who have been using it can stop wasting our time.</description>
    <dc:creator>Szabolcs Horvát</dc:creator>
    <dc:date>2018-04-16T09:54:42Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/214901">
    <title>Building Packages: A basic tutorial</title>
    <link>https://community.wolfram.com/groups/-/m/t/214901</link>
    <description>In a response to an earlier thread I posted a notebook containing a basic tutorial on creating packages in Mathematica. Since the link to the notebook was embedded down in the responses to that post I thought it might be useful to some folks to have access to it at the top level here since they might have missed it. &#xD;
&#xD;
I have updated that notebook a bit since the last time.  I hope it is useful to some people.  It was originally written as a tutorial for a consulting client of mine and he agreed to allow me to share with others.  &#xD;
&#xD;
Enjoy. It is attached to this posting</description>
    <dc:creator>David Reiss</dc:creator>
    <dc:date>2014-03-08T02:32:19Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1715017">
    <title>Run MinGW in Mac?</title>
    <link>https://community.wolfram.com/groups/-/m/t/1715017</link>
    <description>Hi,&#xD;
How can i run Min GW in Mac, do I need to rearrange these codes to make it run in Mac?&#xD;
&#xD;
Can anyone please advise?&#xD;
&#xD;
I posted the codes below.&#xD;
&#xD;
&#xD;
    Clear[&amp;#034;Global`*&amp;#034;];&#xD;
    Needs[&amp;#034;CCompilerDriver`GenericCCompiler`&amp;#034;];&#xD;
    $CCompiler = {&amp;#034;Compiler&amp;#034; -&amp;gt; &#xD;
        CCompilerDriver`GenericCCompiler`GenericCCompiler, &#xD;
       &amp;#034;CompilerInstallation&amp;#034; -&amp;gt; &amp;#034;C:\\MinGW&amp;#034;, &amp;#034;CompilerName&amp;#034; -&amp;gt; &amp;#034;gcc.exe&amp;#034;};&#xD;
    CompileOptions = {CompilationTarget -&amp;gt; &amp;#034;C&amp;#034;, &#xD;
       RuntimeOptions -&amp;gt; {&amp;#034;CatchMachineOverflow&amp;#034; -&amp;gt; False, &#xD;
         &amp;#034;CatchMachineUnderflow&amp;#034; -&amp;gt; False, &#xD;
         &amp;#034;CatchMachineIntegerOverflow&amp;#034; -&amp;gt; False, &#xD;
         &amp;#034;CompareWithTolerance&amp;#034; -&amp;gt; False, &amp;#034;EvaluateSymbolically&amp;#034; -&amp;gt; False,&#xD;
          &amp;#034;RuntimeErrorHandler&amp;#034; -&amp;gt; Evaluate, &amp;#034;WarningMessages&amp;#034; -&amp;gt; False}, &#xD;
       CompilationOptions -&amp;gt; {&amp;#034;InlineExternalDefinitions&amp;#034; -&amp;gt; True, &#xD;
         &amp;#034;InlineCompiledFunctions&amp;#034; -&amp;gt; True, &#xD;
         &amp;#034;ExpressionOptimization&amp;#034; -&amp;gt; True}};&#xD;
&#xD;
Thanks.</description>
    <dc:creator>adrian leong</dc:creator>
    <dc:date>2019-06-29T10:27:32Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/984003">
    <title>How to use Mathematica in a high-performance computing (HPC) environment</title>
    <link>https://community.wolfram.com/groups/-/m/t/984003</link>
    <description>I&amp;#039;m going to show you how you can use existing functionality to run a Mathematica script across a managed HPC cluster. Before I start, I must be upfront with you: though the individual commands are documented, this method, as a whole, is not. Thus, support for this procedure is outside the scope of Wolfram Technical Support. However, I&amp;#039;m hoping that once the ground-work has been laid, that Wolfram Community members can work together to fill in the missing details.&#xD;
&#xD;
My assumptions:&#xD;
&#xD;
 1. Mathematica is installed and properly licensed on the managed cluster&#xD;
 2. once your job has been given resources, that you can freely SSH between them&#xD;
&#xD;
(1) This is up to your local cluster&amp;#039;s System Admin to figure out by talking with their organization and a Wolfram Sales Representative, and possibly Wolfram Technical Support ([support.wolfram.com][1]).&#xD;
(2) Again, this is up to your local SysAdmin to ensure. It&amp;#039;s also known as a public/private key pair between nodes.&#xD;
&#xD;
In the following, I&amp;#039;m assuming the cluster uses Torque ([Torque SysAdmin Guide][2]), but in principle other managers can be used. A generic Mathematica script job submission may look like the following:&#xD;
&#xD;
    #PBS -N Job_name&#xD;
    #PBS -l walltime=10:30&#xD;
    #PBS -l nodes=4:ppn=6&#xD;
    #PBS -m be&#xD;
&#xD;
    math -script hpc.wl&#xD;
    &#xD;
In this example, &#xD;
&#xD;
 - the job is called &amp;#034;Job_name&amp;#034;&#xD;
 - the job will finish in 10 and a half minutes&#xD;
 - it is requesting 4 nodes with 6 processors-per-node, for a total of 24 resources (CPU cores)&#xD;
 - an email will be sent to the account associated with the username when the job (b)egins and when it (e)nds&#xD;
&#xD;
If you are not familiar with job submissions to a managed HPC cluster, then I suggest you read any guides provided by your organization&#xD;
&#xD;
The Wolfram Language script &amp;#034;hpc.wl&amp;#034; does the rest of the work. It generically follows this order:&#xD;
&#xD;
 1. gather the environment variables associated with the list of provided resources&#xD;
 2. launch remote subkernels for each CPU core&#xD;
 3. do the parallel computations&#xD;
 4. close the subkernels&#xD;
 5. end the job&#xD;
&#xD;
        (*get association of resources, name of local host, and remove local host from available resources*)&#xD;
        hosts = Counts[ReadList[Environment[&amp;#034;PBS_NODEFILE&amp;#034;], &amp;#034;String&amp;#034;]];&#xD;
        local = First[StringSplit[Environment[&amp;#034;HOSTNAME&amp;#034;],&amp;#034;.&amp;#034;]];&#xD;
        hosts[local]--;&#xD;
        &#xD;
        (*launch subkernels and connect them to the controlling Wolfram Kernel*)&#xD;
        Needs[&amp;#034;SubKernels`RemoteKernels`&amp;#034;];&#xD;
        Map[If[hosts[#] &amp;gt; 0, LaunchKernels[RemoteMachine[#, hosts[#]]]]&amp;amp;, Keys[hosts]];&#xD;
&#xD;
        (* ===== regular Wolfram Language code goes here ===== *)&#xD;
        Print[ {$MachineName, $KernelID} ]&#xD;
        (* ===== end of Wolfram Language program ===== *)&#xD;
&#xD;
        CloseKernels[];&#xD;
        Quit&#xD;
&#xD;
On Torque there is the environment variable &amp;#034;PBS\_NODEFILE&amp;#034; ([Torque environment variables][3]) that lists the different nodes that are provided to the job. It is my understanding that the name is repeated for each CPU core. That&amp;#039;s why a simple Count of the node list tells us everything. The other piece of information, which is probably not necessary, is &amp;#034;HOSTNAME&amp;#034;. This is where the Wolfram controlling kernel is running. In the above, we remove it from the list of available resources, but I don&amp;#039;t believe this is necessary. According to the documentation ([3]), this may be known as &amp;#034;PBS\_O\_HOSTNAME&amp;#034;.  &#xD;
&#xD;
The Mathematica script should not need to change save for the code between the commented lines. I&amp;#039;m also assuming that `$RemoteCommand` (provided by Subkernels\`RemoteKernels\`) is the same on each node. This is usually the case as most clusters use a cloned file system. &#xD;
&#xD;
SLURM should be very similar except that the environment variables will be different. It is my understanding that&#xD;
&#xD;
        headNode = Environment[&amp;#034;SLURMD_NODENAME&amp;#034;];&#xD;
        nodes = ReadList[&amp;#034;!scontrol show hostname $SLURM_NODELIST&amp;#034;,String]; &#xD;
&#xD;
provides the headnode and list of resources.&#xD;
&#xD;
&#xD;
I encourage discussion.&#xD;
&#xD;
&#xD;
  [1]: http://support.wolfram.com&#xD;
  [2]: http://docs.adaptivecomputing.com/torque/4-0-2/help.htm&#xD;
  [3]: http://docs.adaptivecomputing.com/torque/4-0-2/help.htm#topics/2-jobs/exportedBatchEnvVar.htm</description>
    <dc:creator>Kevin Daily</dc:creator>
    <dc:date>2016-12-19T21:29:53Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1807709">
    <title>Interface with R in Mathematica 12 and R 3.6.1?</title>
    <link>https://community.wolfram.com/groups/-/m/t/1807709</link>
    <description>Hello everybody!&#xD;
&#xD;
 I wrote a number of notebooks calling R packages. But using up-to-date versions (Mathematica 12 and R 3.6.1), nothing works any more! For instance, it seems the default distribution doesn&amp;#039;t exist now:&#xD;
&#xD;
    In[2]:= InstallR[]&#xD;
    REvaluate[&amp;#034;sample(1:100,10)&amp;#034;]&#xD;
    &#xD;
    During evaluation of In[2]:= InstallR::invldrhome: The specified path to R home directory does not point to a valid directory&#xD;
    &#xD;
    Out[2]= $Failed&#xD;
&#xD;
I tried to use my own distribution, but it is not recognized!&#xD;
&#xD;
    In[4]:= InstallR[&amp;#034;RHomeLocation&amp;#034; -&amp;gt; &amp;#034;C:/PROGRA~1/R/R-36~1.1&amp;#034;, &#xD;
     &amp;#034;RVersion&amp;#034; -&amp;gt; &amp;#034;3.6.1&amp;#034;]&#xD;
    &#xD;
    During evaluation of In[5]:= InstallR::fail: Failed to install R. The following error was encountered: crash in low-level RLink component or in R runtime&#xD;
    &#xD;
    Out[5]= $Failed&#xD;
&#xD;
It seems there is an issue with the R.dll file (dll:  3.6.1, expecting 3.5.0). What can I do? Install an older version of R? Which one?&#xD;
&#xD;
Best regards,&#xD;
Claude</description>
    <dc:creator>Claude Mante</dc:creator>
    <dc:date>2019-10-15T09:19:47Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1170226">
    <title>Package development: How to spend less time creating a polished interface?</title>
    <link>https://community.wolfram.com/groups/-/m/t/1170226</link>
    <description>One of the great things about Mathematica is that it makes it so easy to do so much in so little code.  It is partly because of this that I am so frustrated with the amount of time I need to spend developing the *interface* of package functions compared to their *functionality*.&#xD;
&#xD;
Suppose you wrote a Wolfram Language function that does something useful and interesting.  Now you want to wrap it up into a package, and make it usable by everyone.  A polished package is expected to have functions that:&#xD;
&#xD;
 - Will check their input for errors&#xD;
 - Will report errors in an informative way&#xD;
 - Will use messages appropriately (i.e. associate them with the correct symbol name)&#xD;
 - Will adhere to the de-facto Mathematica interface conventions: proper use of optional arguments, options, option inheritance (as in Graphics -&amp;gt; Plot), default option value handling, use of `Automatic`, etc.&#xD;
 - Have SyntaxInformation&#xD;
&#xD;
I find that not infrequently I spend more time on making the function user-friendly than developing its functionality.&#xD;
&#xD;
**How do people generally deal with this task?  How do you implement error checking and reporting in your packages?**&#xD;
&#xD;
To give an example, take a function as simple a moving average calculator.  It is really easy to implement:&#xD;
&#xD;
    movingAverage[vec_, n_] := Mean /@ Partition[vec, n, 1]&#xD;
&#xD;
But to bring it to the quality of the built-in `MovingAverage`, it should at least:&#xD;
&#xD;
 - check the number of arguments (precisely 2)&#xD;
 - check the types of arguments (a list and an integer)&#xD;
 - check the values of arguments for correctness (non-empty list and positive integer)&#xD;
 - make sure that all these checks don&amp;#039;t introduce severe performance degradation (such as array unpacking, which can even be triggered by an inefficient argument pattern)&#xD;
&#xD;
This also involves the introduction of multiple messages (for each type of error) associated to `movingAverage`. If we now want to add a `movingMedian`, we will find that we will mostly need to carry out the same checks and report the same messages. There will be small differences though, e.g. average calculations are feasible for symbolic lists like `{1,x}`, but not median calculations.  So the checks won&amp;#039;t quite be identical.  The messages will be mostly identical, but each function must associate messages to its own symbol, which means a lot of duplication.&#xD;
&#xD;
So if we care about a high-quality interface and high-quality error reporting, we will end up writing considerably more code for this than for the function&amp;#039;s core task. We will also end up with a lot of code duplication, which is frustrating and a maintenance burden.  The whole thing ends up being a lot of work and not a lot of fun (which is not very Mathematica-like :-) )&#xD;
&#xD;
Are there good ways to simplify these tasks?  Option handling also used to be error-prone and frustrating, but the introduction of `OptionsPattern[]` and `OptionValue[]` made it much easier.&#xD;
&#xD;
----&#xD;
&#xD;
I can see that there are some built-in tool to ease these tasks, though they are mostly undocumented.  One example is `ArgumentCountQ`, another is ``Developer`CheckArgumentCount``, or some tools in ``GeneralUtilities` ``.  I would love to hear from others about how they deal with the tasks I described, which such internal functions they make use of, etc.</description>
    <dc:creator>Szabolcs Horvát</dc:creator>
    <dc:date>2017-08-25T11:15:29Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/560469">
    <title>IGraph/M: graph theory and network analysis with Mathematica</title>
    <link>https://community.wolfram.com/groups/-/m/t/560469</link>
    <description>*WOLFRAM MATERIALS for the ARTICLE:*&#xD;
&amp;gt; Szabolcs Horvát, Jakub Podkalicki, Gábor Csárdi, Tamás Nepusz, Vincent Traag, Fabio Zanini, Daniel Noom, (2022).&#xD;
&#xD;
&amp;gt; *IGraph/M: graph theory and network analysis for Mathematica*.&#xD;
&#xD;
&amp;gt; arXiv:2209.09145 **[physics.soc-ph]**.&#xD;
&#xD;
&amp;gt; https://doi.org/10.48550/arXiv.2209.09145&#xD;
&#xD;
&#xD;
[![Discourse topics](https://img.shields.io/discourse/topics?color=limegreen&amp;amp;server=https%3A%2F%2Figraph.discourse.group)](https://igraph.discourse.group)&#xD;
[![GitHub (pre-)release](https://img.shields.io/github/release/szhorvat/IGraphM/all.svg)](https://github.com/szhorvat/IGraphM/releases)&#xD;
[![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](https://github.com/szhorvat/IGraphM#contributions)&#xD;
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1134932.svg)](https://doi.org/10.5281/zenodo.1134932)&#xD;
&#xD;
----&#xD;
&#xD;
##Article abstract&#xD;
&#xD;
IGraph/M is an efficient general purpose graph theory and network analysis package for Mathematica. IGraph/M serves as the Wolfram Language interfaces to the igraph C library, and also provides several unique pieces of functionality not yet present in igraph, but made possible by combining its capabilities with Mathematica&amp;#039;s. The package is designed to support both graph theoretical research as well as the analysis of large-scale empirical networks.&#xD;
&#xD;
----&#xD;
&#xD;
##Introduction&#xD;
&#xD;
The post below was written for the original release of IGraph/M. The package has come a long way since then and now contains ~300 functions. See http://szhorvat.net/mathematica/IGraphM for more details on the current release.&#xD;
&#xD;
Compatibility: 64-it Windows/macOS/Linux or Raspberry Pi; Mathematica &amp;lt;del&amp;gt;10.0&amp;lt;/del&amp;gt; 11.0 or later.&#xD;
&#xD;
&amp;lt;a href=&amp;#034;http://szhorvat.net/mathematica/IGraphM&amp;#034;&amp;gt;&amp;lt;img src=&amp;#034;https://community.wolfram.com//c/portal/getImageAttachment?filename=IGraphM-ad-3.png&amp;amp;userId=38370&amp;#034; width=&amp;#034;300&amp;#034;&amp;gt;&amp;lt;/a&amp;gt;&#xD;
&#xD;
----&#xD;
&#xD;
I would like to announce IGraph/M, a new igraph interface for Mathematica: http://szhorvat.net/mathematica/IGraphM&#xD;
&#xD;
[igraph](http://igraph.org/) is a graph manipulation and analysis package.  IGraph/M makes its functionality available from Mathematica.&#xD;
&#xD;
This initial release, version 0.1, covers only some igraph functions, as I focused on the things that I need personally.  However the main framework is complete, and new functions can be added quickly.  If anyone would like to contribute, please contact me.&#xD;
&#xD;
Binary packages for OS X (10.9 or later) and Linux can be downloaded [from GitHub](https://github.com/szhorvat/IGraphM/releases).  Unfortunately, I was unable to compile the development version of igraph for Windows, so I cannot provide a Windows version. If you can help with compiling igraph itself (not IGraph/M) on Windows, please let me know!&#xD;
&#xD;
Functionality in this release that is not built into Mathematica:&#xD;
&#xD;
 * Vertex betweenness centrality for weighted graphs&#xD;
 * Estimates of vertex betweenness, edge betweenness and closeness centrality; for large graphs&#xD;
 * Minimum feedback arc set for weighted and unweighted graphs&#xD;
 * Find all cliques (not just maximal ones)&#xD;
 * Count 3- and 4-motifs&#xD;
 * Rewire edges, keeping either the density or the degree sequence&#xD;
 * Alternative algorithms for isomorphism testing: Bliss, VF2&#xD;
 * Subgraph isomorphism&#xD;
 * Test if a degree sequence is graphical&#xD;
 * Alternative algorithms for generating random graphs with given degree sequence&#xD;
 * Layout algorithms that take weights into account&#xD;
&#xD;
Note that IGraph/M is *not a replacement* for Mathematica&amp;#039;s graphs and networks functionality.  It is meant to complement what is already available in Mathematica, thus it primarily focuses on adding functionality that is not already present.&#xD;
&#xD;
Why did I release the package before covering most of the igraph functionality?  I do not have time to work on things I do not personally need or use, so I am unlikely to extend it further unless the need comes up.  I do think that the functions that are included in v0.1 can already be useful to others too.  I would also like to give the opportunity for people to contribute to the project if they wish to.  The groundwork has been laid, so further extensions should be quick and relatively easy.&#xD;
&#xD;
Also check out a related project, [IGraphR](https://github.com/szhorvat/IGraphR), which makes igraph available for Mathematica users through RLink.  I wrote IGraph/M because I needed higher performance and greater reliability (especially for parallel computing) than what RLink could provide.&#xD;
&#xD;
----&#xD;
&#xD;
**A request:** If any of you have used IGraphR in the past to access igraph from Mathematica, please post a response to this thread and let me know which specific functions you were using.&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/94639221-60b4-47e3-8862-d996caa40388</description>
    <dc:creator>Szabolcs Horvát</dc:creator>
    <dc:date>2015-09-06T12:55:14Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1484511">
    <title>Playing with YouTube from Mathematica</title>
    <link>https://community.wolfram.com/groups/-/m/t/1484511</link>
    <description>Originally [here](https://www.wolframcloud.com/objects/b3m2a1/home/playing-with-youtube-from-mathematica.html#main-content) (the embedded iframes actually work there)&#xD;
&#xD;
---&#xD;
&#xD;
Playing with YouTube from Mathematica&#xD;
---&#xD;
&#xD;
Today I&amp;#039;m gonna quickly show off something I made for a friend (and about which I&amp;#039;d been thinking for some time). We&amp;#039;re gonna use the YouTube API in Mathematica to do a have some fun (but not too much fun, mind you!).&#xD;
&#xD;
### Installing the YouTube Connection&#xD;
&#xD;
My connection to the YouTube API is built on Mathematica&amp;#039;s  [```ServiceConnect```](https://reference.wolfram.com/language/ref/ServiceConnect.html) framework. I&amp;#039;ve  [talked](https://www.wolframcloud.com/objects/b3m2a1/home/serviceconnections---mathematica-on-the-web.html)  [about](https://www.wolframcloud.com/objects/b3m2a1/home/questions-on-the-mathematica-stack-exchange.html#main-content)  [these](https://www.wolframcloud.com/objects/b3m2a1/home/questions-on-the-mathematica-stack-exchange-part-2.html#main-content)  [before](https://mathematica.stackexchange.com/questions/163638/how-can-i-access-nasa-images-and-apis) in  [many](http://community.wolfram.com/groups/-/m/t/1261562)  [different](https://mathematica.stackexchange.com/a/167702/38205)  [contexts](https://mathematica.stackexchange.com/questions/163780/sophisticated-api-integrations-making-a-card-game-in-mathematica) but today we&amp;#039;ll just use it. To install we pull the  [paclet off my server](https://www.wolframcloud.com/objects/b3m2a1.paclets/PacletServer/serviceconnectionyoutube.html#main-content) :&#xD;
&#xD;
    PacletInstall[&amp;#034;ServiceConnection_YouTube&amp;#034;,&#xD;
      &amp;#034;Site&amp;#034;-&amp;gt;&#xD;
        &amp;#034;http://www.wolframcloud.com/objects/b3m2a1.paclets/PacletServer/&amp;#034;&#xD;
      ]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-8529256040837869960](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-8529256040837869960.png)&#xD;
&#xD;
### Authenticating with YouTube&#xD;
&#xD;
One installed, we connect to the service as usual:&#xD;
&#xD;
    $so = ServiceConnect[&amp;#034;YouTube&amp;#034;]&#xD;
&#xD;
This will open a dialog:&#xD;
&#xD;
![post22-2534758878895670558](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-2534758878895670558.png)&#xD;
&#xD;
We&amp;#039;ll click the sign in button, pick and account (I&amp;#039;ll use my  [new personal account steve.wolfraum@gmail.com](https://www.wolframcloud.com/objects/b3m2a1/home/making-a-blog-in-30-minutes.html#main-content) ):&#xD;
&#xD;
![post22-6891487155877384696](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-6891487155877384696.png)&#xD;
&#xD;
When we click &amp;#034;Allow&amp;#034; either we&amp;#039;ll be taken to a nicely formatted local page with an access code running via  ```HTTPHandling`StartWebServer``` or if that&amp;#039;s being glitchy as it was right now, we&amp;#039;ll copy the part of the URL starting with  ```&amp;#034;code=4/...&amp;#034;``` :&#xD;
&#xD;
![post22-5755985516881850876](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-5755985516881850876.png)&#xD;
&#xD;
Finally, we&amp;#039;re connected:&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-6049558537553480280](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-6049558537553480280.png)&#xD;
&#xD;
### Getting Data&#xD;
&#xD;
The majority of the currently supported methods have to do with getting data about YouTube:&#xD;
&#xD;
    $so[&amp;#034;Requests&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
    {&amp;#034;Authentication&amp;#034;,&amp;#034;DeleteVideo&amp;#034;,&amp;#034;ID&amp;#034;,&amp;#034;Information&amp;#034;,&amp;#034;LastRequest&amp;#034;,&amp;#034;ListCaptions&amp;#034;,&amp;#034;ListChannelActivity&amp;#034;,&amp;#034;ListChannels&amp;#034;,&amp;#034;ListChannelSections&amp;#034;,&amp;#034;ListComments&amp;#034;,&amp;#034;ListCommentThreads&amp;#034;,&amp;#034;ListPlaylistItems&amp;#034;,&amp;#034;ListPlaylists&amp;#034;,&amp;#034;ListSubscriptions&amp;#034;,&amp;#034;ListVideos&amp;#034;,&amp;#034;Name&amp;#034;,&amp;#034;RawRequests&amp;#034;,&amp;#034;RequestData&amp;#034;,&amp;#034;RequestParameters&amp;#034;,&amp;#034;Search&amp;#034;,&amp;#034;UpdateVideo&amp;#034;,&amp;#034;UploadVideo&amp;#034;,&amp;#034;VideoURL&amp;#034;}&#xD;
&#xD;
We&amp;#039;ll start with a search, maybe. First let&amp;#039;s see what parameters we have to work with:&#xD;
&#xD;
    $so[&amp;#034;RequestParameters&amp;#034;, &amp;#034;Request&amp;#034;-&amp;gt;&amp;#034;Search&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
    &amp;lt;|&amp;#034;Parameters&amp;#034;-&amp;gt;{&amp;#034;q&amp;#034;,&amp;#034;part&amp;#034;,&amp;#034;forContentOwner&amp;#034;,&amp;#034;forDeveloper&amp;#034;,&amp;#034;forMine&amp;#034;,&amp;#034;relatedToVideoId&amp;#034;,&amp;#034;channelId&amp;#034;,&amp;#034;channelType&amp;#034;,&amp;#034;eventType&amp;#034;,&amp;#034;location&amp;#034;,&amp;#034;locationRadius&amp;#034;,&amp;#034;maxResults&amp;#034;,&amp;#034;onBehalfOfContentOwner&amp;#034;,&amp;#034;order&amp;#034;,&amp;#034;pageToken&amp;#034;,&amp;#034;publishedAfter&amp;#034;,&amp;#034;publishedBefore&amp;#034;,&amp;#034;q&amp;#034;,&amp;#034;regionCode&amp;#034;,&amp;#034;relevanceLanguage&amp;#034;,&amp;#034;safeSearch&amp;#034;,&amp;#034;topicId&amp;#034;,&amp;#034;type&amp;#034;,&amp;#034;videoCaption&amp;#034;,&amp;#034;videoCategoryId&amp;#034;,&amp;#034;videoDefinition&amp;#034;,&amp;#034;videoDimension&amp;#034;,&amp;#034;videoDuration&amp;#034;,&amp;#034;videoEmbeddable&amp;#034;,&amp;#034;videoLicense&amp;#034;,&amp;#034;videoSyndicated&amp;#034;,&amp;#034;videoType&amp;#034;},&amp;#034;Required&amp;#034;-&amp;gt;{&amp;#034;part&amp;#034;}|&amp;gt;&#xD;
&#xD;
Then we&amp;#039;ll search for something bland, like &amp;#034;Steve Wolfraum&amp;#034;. The YouTube API requires this  ```&amp;#034;part&amp;#034;``` parameter to know what to return to use. I like to get the  ```&amp;#034;id&amp;#034;``` and  ```&amp;#034;snippet&amp;#034;``` parts, but you can  [pick for yourself](https://developers.google.com/youtube/v3/getting-started#part) which parts you want. Just comma-separate your values and you can get multiple different ones:&#xD;
&#xD;
    mySearch = $so[&amp;#034;Search&amp;#034;, &amp;#034;q&amp;#034;-&amp;gt;&amp;#034;Steve Wolfraum&amp;#034;, &amp;#034;part&amp;#034;-&amp;gt;&amp;#034;id,snippet&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-4316213154658629458](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-4316213154658629458.png)&#xD;
&#xD;
We see there are  *tons* of results for &amp;#034;my&amp;#034; name but we only get them five at a time. We can use the  ```&amp;#034;nextPageToken&amp;#034;``` to get the next page of results, though. We can bump up the number we get with the  ```&amp;#034;maxResults&amp;#034;``` parameter, but I see no need for that right now. Let&amp;#039;s look at the first result here. I&amp;#039;ll drill straight into that snippet parameter, as that&amp;#039;s the most interesting part:&#xD;
&#xD;
    mySearch[&amp;#034;items&amp;#034;, 1, &amp;#034;snippet&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-498969337448306280](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-498969337448306280.png)&#xD;
&#xD;
And we see, sadly, that instead of getting results for my name, Steve Wolfraum, we get them for some random dude name Stephen Wolfram. Not to be deterred, let&amp;#039;s at least get something out of this and see a thumbnail for all our results. Tragically, we can&amp;#039;t download videos with the YouTube API, but at least we get thumbnails...hooray? To make things more fun, we&amp;#039;ll also add a filter to all these results, as the raw thumbnails really aren&amp;#039;t all that interesting.&#xD;
&#xD;
    ImageAdjust@LaplacianGaussianFilter[Import[#], 3]&amp;amp;/@&#xD;
      Normal@mySearch[&amp;#034;items&amp;#034;, All, &amp;#034;snippet&amp;#034;, &amp;#034;thumbnails&amp;#034;, &amp;#034;high&amp;#034;, &amp;#034;url&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-8416895123856568403](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-8416895123856568403.png)&#xD;
&#xD;
Cool. There&amp;#039;s some data. We can also pull out statistics and things, say for different videos broadcast on the Wolfram Research channel. First we&amp;#039;ll get their channel ID:&#xD;
&#xD;
    wriChannel=&#xD;
      $so[&amp;#034;Search&amp;#034;, &amp;#034;q&amp;#034;-&amp;gt;&amp;#034;Wolfram Research&amp;#034;, &amp;#034;type&amp;#034;-&amp;gt;&amp;#034;channel&amp;#034;,&#xD;
        &amp;#034;part&amp;#034;-&amp;gt;&amp;#034;id&amp;#034;, &amp;#034;maxResults&amp;#034;-&amp;gt;&amp;#034;1&amp;#034;][&amp;#034;items&amp;#034;, 1, &amp;#034;id&amp;#034;, &amp;#034;channelId&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
    &amp;#034;UCJekgf6k62CQHdENWf2NgAQ&amp;#034;&#xD;
&#xD;
Now we&amp;#039;ll use this to extract the 50 most popular videos:&#xD;
&#xD;
    wriVids=$so[&amp;#034;Search&amp;#034;, &amp;#034;channelId&amp;#034;-&amp;gt;wriChannel, &amp;#034;type&amp;#034;-&amp;gt;&amp;#034;video&amp;#034;, &#xD;
      &amp;#034;order&amp;#034;-&amp;gt;&amp;#034;viewCount&amp;#034;, &amp;#034;part&amp;#034;-&amp;gt;&amp;#034;id,snippet&amp;#034;, &amp;#034;maxResults&amp;#034;-&amp;gt;&amp;#034;50&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-5403531027782801587](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-5403531027782801587.png)&#xD;
&#xD;
And now we&amp;#039;ll get view counts:&#xD;
&#xD;
    wriStats=$so[&amp;#034;ListVideos&amp;#034;, &#xD;
      &amp;#034;id&amp;#034;-&amp;gt;StringRiffle[Normal@wriVids[&amp;#034;items&amp;#034;, All, &amp;#034;id&amp;#034;, &amp;#034;videoId&amp;#034;], &amp;#034;,&amp;#034;], &#xD;
      &amp;#034;part&amp;#034;-&amp;gt;&amp;#034;statistics&amp;#034;&#xD;
      ]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-4181911101890639189](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-4181911101890639189.png)&#xD;
&#xD;
And then we&amp;#039;ll make a  [```WordCloud```](https://reference.wolfram.com/language/ref/WordCloud.html) of titles vs viewcounts:&#xD;
&#xD;
    WordCloud@&#xD;
      AssociationThread[&#xD;
        Normal@wriVids[&amp;#034;items&amp;#034;, All, &amp;#034;snippet&amp;#034;, &amp;#034;title&amp;#034;],&#xD;
        ToExpression@Normal@wriStats[&amp;#034;items&amp;#034;, All, &amp;#034;statistics&amp;#034;, &amp;#034;viewCount&amp;#034;]&#xD;
        ]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-948349109694102953](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-948349109694102953.png)&#xD;
&#xD;
And we see as far as YouTube cares, there&amp;#039;s really only one video WRI has made. But dropping that one we might see some more interesting structure:&#xD;
&#xD;
    WordCloud@&#xD;
      AssociationThread[&#xD;
        Rest@Normal@wriVids[&amp;#034;items&amp;#034;, All, &amp;#034;snippet&amp;#034;, &amp;#034;title&amp;#034;],&#xD;
        Rest@ToExpression@Normal@wriStats[&amp;#034;items&amp;#034;, All, &amp;#034;statistics&amp;#034;, &amp;#034;viewCount&amp;#034;]&#xD;
        ]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-978266547142309807](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-978266547142309807.png)&#xD;
&#xD;
And it seems that people really like the basics and...really like seismic waves?&#xD;
&#xD;
I&amp;#039;ll embed the first of those so we can see how good the really are:&#xD;
&#xD;
    $so[&amp;#034;EmbedIFrame&amp;#034;, &amp;#034;id&amp;#034;-&amp;gt;wriVids[&amp;#034;items&amp;#034;, 3, &amp;#034;id&amp;#034;, &amp;#034;videoId&amp;#034;]]&#xD;
&#xD;
    (* Out *)&#xD;
    &amp;lt;iframe id=&amp;#034;ytplayer&amp;#034; type=&amp;#034;text/html&amp;#034; width=&amp;#034;640&amp;#034; height=&amp;#034;360&amp;#034;&#xD;
    src=&amp;#034;https://www.youtube.com/embed/2rYjlVPU9U4?autoplay=0&amp;#034;&#xD;
      frameborder=&amp;#034;0&amp;#034;&amp;gt;&amp;lt;/iframe&amp;gt;&#xD;
&#xD;
&#xD;
### Uploading Videos&#xD;
&#xD;
A YouTube API wouldn&amp;#039;t be much of a YouTube API if it couldn&amp;#039;t upload videos, of course, so I cooked that in as well.&#xD;
&#xD;
Here&amp;#039;s a sample of that. We&amp;#039;ll first pull an animation off the  [```Manipulate```](https://reference.wolfram.com/language/ref/Manipulate.html) docs:&#xD;
&#xD;
    anim =&#xD;
      Export[&#xD;
        FileNameJoin@{$TemporaryDirectory, &amp;#034;plot3d.flv&amp;#034;},&#xD;
        Manipulate[&#xD;
          Plot3D[Sin[n x y], &#xD;
            {x, 0, 3}, {y, 0, 3}, &#xD;
            ViewPoint -&amp;gt; Dynamic[{2, v, 2}], SphericalRegion -&amp;gt; True, Ticks -&amp;gt; None,&#xD;
            PerformanceGoal-&amp;gt;&amp;#034;Quality&amp;#034;&#xD;
            ], &#xD;
          {n, 1, 4}, &#xD;
          {v, -2, 2}&#xD;
          ]&#xD;
        ];&#xD;
&#xD;
Then we&amp;#039;ll upload the video we made:&#xD;
&#xD;
    upload = $so[&amp;#034;UploadVideo&amp;#034;, &amp;#034;part&amp;#034;-&amp;gt;&amp;#034;id&amp;#034;, &amp;#034;BodyContent&amp;#034;-&amp;gt;anim];&#xD;
&#xD;
Then we attach a title and things in a second request:&#xD;
&#xD;
    $so[&amp;#034;UpdateVideo&amp;#034;, &amp;#034;id&amp;#034; -&amp;gt; upload[&amp;#034;id&amp;#034;],&#xD;
     &amp;#034;part&amp;#034; -&amp;gt; &amp;#034;snippet&amp;#034;,&#xD;
      &amp;#034;Title&amp;#034; -&amp;gt; &amp;#034;Mathematica Examples: Plot 3D&amp;#034;,&#xD;
     &amp;#034;CategoryID&amp;#034; -&amp;gt; &amp;#034;22&amp;#034;&#xD;
     ]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![post22-4324612576805415951](https://www.wolframcloud.com/objects/b3m2a1/home/img/post22-4324612576805415951.png)&#xD;
&#xD;
And then now we&amp;#039;ll embed that video we just made:&#xD;
&#xD;
    $so[&amp;#034;EmbedIFrame&amp;#034;, &amp;#034;id&amp;#034;-&amp;gt;upload[&amp;#034;id&amp;#034;]]&#xD;
&#xD;
    (* Out *)&#xD;
    &amp;lt;iframe id=&amp;#034;ytplayer&amp;#034; type=&amp;#034;text/html&amp;#034; width=&amp;#034;640&amp;#034; height=&amp;#034;360&amp;#034;&#xD;
    src=&amp;#034;https://www.youtube.com/embed/Quzcr4Vuq_Q?autoplay=0&amp;#034;&#xD;
      frameborder=&amp;#034;0&amp;#034;&amp;gt;&amp;lt;/iframe&amp;gt;</description>
    <dc:creator>b3m2a1 ​ </dc:creator>
    <dc:date>2018-09-29T04:42:36Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1646303">
    <title>UNET: neural network for 2D &amp;amp; 3D image segmentation w/ medical examples</title>
    <link>https://community.wolfram.com/groups/-/m/t/1646303</link>
    <description># UNET [![DOI](https://zenodo.org/badge/137186334.svg)](https://zenodo.org/badge/latestdoi/137186334) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/dwyl/esta/issues)&#xD;
&#xD;
&#xD;
----------&#xD;
&#xD;
![Automated 3D muscle segmentation using UNET / RESNET using DIXON MRI data][17]&#xD;
&#xD;
&#xD;
A package to generate and train a UNET deep convolutional network for 2D and 3D image segmentation.&#xD;
&#xD;
Some code was based on [work][1] by [@Ali Hashmi][at0], which was also dicussed in [this post][2] &#xD;
The full version of the toolbox can be found on my [github page][3].&#xD;
&#xD;
* [Information](#information)&#xD;
* [Install toolbox](#install-toolbox)&#xD;
* [Using the toolbox](#using-the-toolbox)&#xD;
* [Functionality](#functionality)&#xD;
* [Visualization](#visualization)&#xD;
* [Example](#example)&#xD;
&#xD;
## Information&#xD;
&#xD;
UNET is developed for [Mathematica](https://www.wolfram.com/mathematica/).&#xD;
It contains the following toolboxes:&#xD;
&#xD;
- UnetCore&#xD;
- UnetSupport&#xD;
&#xD;
Documentation of all functions and their options is fully integrated in the Mathematica documentation.&#xD;
The toolbox always works within the latest version of Mathematica and does not support any backward compatibility.&#xD;
&#xD;
All code and documentation is maintained and uploaded to github using [Workbench](https://www.wolfram.com/workbench/).&#xD;
&#xD;
## Install toolbox&#xD;
&#xD;
Install the toolbox in the Mathematica UserBaseDirectory &amp;gt; Applications.&#xD;
&#xD;
	FileNameJoin[{$UserBaseDirectory, &amp;#034;Applications&amp;#034;}]&#xD;
  &#xD;
## Using the toolbox&#xD;
&#xD;
The toolbox can be loaded by using &amp;lt;&amp;lt;UNET`&#xD;
&#xD;
The notbook ``UNET.nb`` shows examples of how to use the toolbox on artificially generated 2D data. &#xD;
There are also examples how to visualize the layer of your trained network and how to visualize the training itself. &#xD;
&#xD;
## Functionality&#xD;
&#xD;
The network supports multi channel inputs and multi class segmentation.&#xD;
&#xD;
* UNET generates a UNET convolutional network.  &#xD;
    * 2D UNET  &#xD;
![UNET 2D][4]&#xD;
    * 3D UNET  &#xD;
![UNET 3D][5]&#xD;
&#xD;
* Loss Layers: Training the data is done using three loss layers: a SoftDiceLossLayer, BrierLossLayer and a CrossEntropyLossLayer.  &#xD;
![SoftDiceLossLayer, BrierLossLayer and a CrossEntropyLossLayer][6]&#xD;
&#xD;
* Convolution Blocks: The toobox contains five different convolution blocks that build up the network: [UNET][7], UResNet, [RestNet][8], UDenseNet, [DensNet][9].  &#xD;
![Convolution blocks][10]&#xD;
&#xD;
* SplitTrainData splits the data and labels into training, validation and test data.  &#xD;
![split train Data][11]&#xD;
&#xD;
* TrainUNET trains the network.  &#xD;
![Train UNET][12]&#xD;
&#xD;
## Visualization&#xD;
&#xD;
* Visualize the network and results.  &#xD;
    * Visualize the features of the layers.  &#xD;
![Visualize layer features][13]&#xD;
    * Visualize the results.  &#xD;
![Visualize the results][14]&#xD;
    * Animate the training process.  &#xD;
![UNET 2D animation][15]  &#xD;
![UNET 3D animation][16]&#xD;
&#xD;
## Example&#xD;
&#xD;
* Example: 3D segmentation of lower legg muscles using MRI data.  &#xD;
&#xD;
![Automated 3D muscle segmentation using UNET / RESNET using DIXON MRI data][17]&#xD;
&#xD;
&#xD;
  [1]: https://github.com/alihashmiii/UNet-Segmentation-Wolfram&#xD;
  [2]: https://community.wolfram.com/groups/-/m/t/1341081?p_p_auth=w8PIeeiA&#xD;
  [3]: https://github.com/mfroeling&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=UNET2D.PNG&amp;amp;userId=1332602&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=UNET3D.PNG&amp;amp;userId=1332602&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Loss.PNG&amp;amp;userId=1332602&#xD;
  [7]: https://arxiv.org/abs/1505.04597&#xD;
  [8]: https://arxiv.org/abs/1512.03385&#xD;
  [9]: https://arxiv.org/abs/1608.06993&#xD;
  [10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=convblocks.PNG&amp;amp;userId=1332602&#xD;
  [11]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Split.PNG&amp;amp;userId=1332602&#xD;
  [12]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Train.PNG&amp;amp;userId=1332602&#xD;
  [13]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Visualize1.PNG&amp;amp;userId=1332602&#xD;
  [14]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Visualize2.PNG&amp;amp;userId=1332602&#xD;
  [15]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amin0-v2.gif&amp;amp;userId=1332602&#xD;
  [16]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amin4-v2.gif&amp;amp;userId=1332602&#xD;
  [17]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Muscle_Segmentation.jpg&amp;amp;userId=1332602&#xD;
&#xD;
 [at0]: https://community.wolfram.com/web/alihashmi87</description>
    <dc:creator>Martijn Froeling</dc:creator>
    <dc:date>2019-04-03T20:01:26Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1655203">
    <title>EasyIDE: An IDE for Mathematica</title>
    <link>https://community.wolfram.com/groups/-/m/t/1655203</link>
    <description>This is a cross-post from [here](https://b3m2a1.github.io/easyide-an-ide-for-mathematica.html)&#xD;
&#xD;
---&#xD;
Contrary to what would probably be best practice, I do all of my Mathematica development inside Mathematica itself. To support this I built out a suite of  [application development tools](https://paclets.github.io/PacletServer/btools.html) , a  [web site builder](https://paclets.github.io/PacletServer/ems.html) , a  [bug tracker](https://github.com/b3m2a1/BugTracker) , and a  [documentation writing system](https://paclets.github.io/PacletServer/simpledocs.html) . Each of these worked nicely for me separately, but each of these required a palette and each one ran on notebooks, which meant that my screen filled with too many notebooks to keep track of. And then for each of these palettes and systems I had to write new resource finding code based off the palette or some arbitrarily imposed root directory or else provide some other way to specify where things would be found.&#xD;
&#xD;
In short, it got messy.&#xD;
&#xD;
Then, in a very relaxing hiatus from Mathematica I did some python development, writing a package for linking  [Mathematica to python](https://paclets.github.io/PacletServer/pjlink.html) as well as some stuff for coordinate transforms and finite differencing and other little utilities. In doing this I noticed that everything was just...better. Partly this is because python is much nicer to write significant amounts of code in, being a language that actually supports developers and with actual object orientation and modularity. But another significant part of it was in the tools available to me. In particular I had the python plugin to  [IntelliJ](https://www.jetbrains.com/idea/) , which is also repackaged as  [PyCharm](https://www.jetbrains.com/pycharm/) . The fact that I had tabbing, plugins (e.g. for  [Git](https://git-scm.com/) ), a file browser inside my dev environment, etc. was at once so entirely normal (I used to be a python programmer before switching over to mostly using Mathematica) and at the same time so nice. I then tried to use the  *very nice and well constructed*  [IntelliJ plugin for Mathematica](https://wlplugin.halirutan.de/) but it was just too much of a hurdle to lose everything I was used to and liked about writing my code directly in Mathematica.&#xD;
&#xD;
And that long, unnecessary background is why today we&amp;#039;re gonna look at a Mathematica IDE written and operating entirely within Mathematica.&#xD;
&#xD;
&#xD;
&#xD;
# EasyIDE&#xD;
&#xD;
Mostly for the rhyme, I called this thing  [EasyIDE](https://paclets.github.io/PacletServer/easyide.html) but it is pretty easy to use, too.&#xD;
&#xD;
&#xD;
&#xD;
## Basics&#xD;
&#xD;
&#xD;
&#xD;
###Installation&#xD;
&#xD;
Install it off the  [Paclet Server](https://paclets.github.io/PacletServer/) :&#xD;
&#xD;
    &amp;lt;&amp;lt; https://paclets.github.io/PacletServer/Install.wl&#xD;
    PublicPacletInstall[&amp;#034;EasyIDE&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
&#xD;
![post27-5677831900721146064](https://b3m2a1.github.io/img/post27-5677831900721146064.png)&#xD;
&#xD;
&#xD;
###Making a New IDE Notebook&#xD;
&#xD;
This IDE system is also basically just a package and a stylesheet, so it&amp;#039;s pretty easy to get started. Simply go to  `Format ? Stylesheet ? EasyIDE ? LightMode` . It&amp;#039;ll prompt you for a directory to use as the root directory. Here&amp;#039;s a video as an example:&#xD;
&#xD;
[![intro1](https://i.stack.imgur.com/YokQs.png)](https://www.youtube.com/watch?v=TMHiN9Ov2fQ)&#xD;
&#xD;
You can play around with the file browser now or the plugin menus in the top right&#xD;
&#xD;
&#xD;
&#xD;
###Notebooks, Packages, and Text Files&#xD;
&#xD;
As things currently stand, the IDE recognizes three types of files to handle in different ways. The first, of course, are plain notebooks. These can be manipulated like normal. Here&amp;#039;s an example of making and editing a notebook file in the IDE:&#xD;
&#xD;
[![intro 2](https://i.stack.imgur.com/76Gcd.png)](https://www.youtube.com/watch?v=I1MnB7duneA)&#xD;
&#xD;
Text and package files can be made in the same way--just assign the appropriate file extension.&#xD;
&#xD;
Each of these files will work basically as a regular file would, except their contents will be saved to their original file on the disk rather than the current  `NotebookFileName[]` .&#xD;
&#xD;
&#xD;
&#xD;
###The File Browser&#xD;
&#xD;
One of the most useful and intuitive features of this IDE is the file browser it has built in. This allows you to quickly find files inside the active directory. Here&amp;#039;s a screen shot of what that can look like:&#xD;
&#xD;
![post27-1442079965320612466](https://b3m2a1.github.io/img/post27-1442079965320612466.png)&#xD;
&#xD;
Each entry in this has a  `ContextMenu` that allows for some file- or directory-specific actions.&#xD;
&#xD;
&#xD;
&#xD;
###Stylesheet / Extension Based Behavior&#xD;
&#xD;
EasyIDE is built to be extensible. It provides a way to get different behavior depending on what would be useful for the specific type of notebook or file is being fed in. These are controlled in the EasyIDE settings, in particular at  `EasyIDE ? Resources ? Settings ? Mappings` where there are many files that control how these should map. This directory may also be created in  `$UserBaseDirectory/ApplicationData` and the settings there will take precedence over those in the paclet folder itself.&#xD;
&#xD;
These customizations include stylesheets, toolbars, and what to do when the file browser is active.&#xD;
&#xD;
&#xD;
&#xD;
###Plugins and Toolbars&#xD;
&#xD;
Probably the best feature of having something like EasyIDE is the ability to hook external code into the IDE and have it give new, more powerful capabilities. To make this easy to work with I added both a plugin system and a toolbar system (although the latter is really just a special case of the first). Plugins appear as either menus--such as the  `File` and  `Project` menus which are themselves just plugins--or as commands under the plugins menu. Currently I already have a decent number of these:&#xD;
&#xD;
![post27-6483075564890356321](https://b3m2a1.github.io/img/post27-6483075564890356321.png)&#xD;
&#xD;
All of these add new functionality to the IDE based on code I&amp;#039;d written before. In that screenshot you can also see a toolbar, which exists right below the tabs. This can be stylesheet specific and thus adds an even more targeted way to add functionality to the system. Here&amp;#039;s an example of the four different toolbars I&amp;#039;ve implemented as well as the different stylesheets they go with:&#xD;
&#xD;
[![intro 3](https://i.stack.imgur.com/QHCwH.png)](https://www.youtube.com/watch?v=fFiDiO-oM7w)&#xD;
&#xD;
In that you can also see the major downside of putting everything into an IDE: when the files get big (as is the one I&amp;#039;m using to write this post) things can get slower. On the other hand as long as one is only writing code, this is never an issue. And even with a ~12MB file like this things are still more than fast enough to not be frustrating to work with.&#xD;
&#xD;
## Extensions&#xD;
&#xD;
###Styles&#xD;
&#xD;
EasyIDE was built to be customizable. This holds first and foremost for the stylesheets it works with. Even though currently there is only a set of LightMode styles, as DarkMode style set could be constructed without too much more difficulty. To do this, one would merely have to take the existing LightMode stylesheet, copy it, and make the necessary cosmetic changes. These changes should then propagate reasonably naturally to the extension styles if the inheritance is changed. This is on the TODO list, but if there is a quality existing DarkMode stylesheet to work off that would also make life much easier.&#xD;
&#xD;
###Plugins and Toolbars&#xD;
&#xD;
These may be hooked in by adding things to  `EasyIDE ? Resources ? Settings ? Plugins` and  `EasyIDE ? Resources ? Settings ? Toolbars` . There are a number of good examples there already.&#xD;
&#xD;
###Miscellaneous Extensions&#xD;
&#xD;
I had already implemented stuff for creating nice docs, Markdown notebooks, websites, bug tracking, paclet creation, etc. and some of this has made it in as plugins already. More is forthcoming, but for now one can always play with what&amp;#039;s in the Plugins menu. In particular the Git plugin is useful for me as I write and develop.&#xD;
&#xD;
###The EasyIDE API&#xD;
&#xD;
EasyIDE is just a collection of functions wrapped into a single unit. These were designed to (hopefully) be modular and clean to work with. Eventually all core functionality will also make its way to being attached to a single object, the  `IDENotebookObject` . The API for this is based off of my  [InterfaceObjects](https://paclets.github.io/PacletServer/interfaceobjects.html) package and is object-oriented. This will be documented in due time, but as a taste here&amp;#039;s what it can look like:&#xD;
&#xD;
&#xD;
    ide = IDENotebookObject[]&#xD;
&#xD;
    (*Out:*)&#xD;
&#xD;
![post27-2774621243698091573](https://b3m2a1.github.io/img/post27-2774621243698091573.png)&#xD;
&#xD;
    ide@&amp;#034;Methods&amp;#034;&#xD;
&#xD;
    (*Out:*)&#xD;
&#xD;
    {&amp;#034;Open&amp;#034;,&amp;#034;Save&amp;#034;,&amp;#034;Close&amp;#034;,&amp;#034;SwitchTab&amp;#034;,&amp;#034;Path&amp;#034;,&amp;#034;Data&amp;#034;,&amp;#034;SetData&amp;#034;,&amp;#034;ToggleFileViewer&amp;#034;,&amp;#034;AddToolbar&amp;#034;,&amp;#034;RemoveToolbar&amp;#034;,&amp;#034;AddStyles&amp;#034;,&amp;#034;RemoveStyles&amp;#034;,&amp;#034;GetStylesheet&amp;#034;,&amp;#034;SetStylesheet&amp;#034;,&amp;#034;SetProjectDirectory&amp;#034;,&amp;#034;CreateMessage&amp;#034;,&amp;#034;CreateDialog&amp;#034;}&#xD;
&#xD;
These  `&amp;#034;Methods&amp;#034;` are all operations that the IDE notebook referenced to by  `EvaluationNotebook[]` can perform. Here&amp;#039;s an example of creating a message:&#xD;
&#xD;
&#xD;
    ide@&amp;#034;CreateMessage&amp;#034;[&amp;#034;Hello!&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
&#xD;
![post27-6469651990570110283](https://b3m2a1.github.io/img/post27-6469651990570110283.png)&#xD;
&#xD;
![post27-316085028871083490](https://b3m2a1.github.io/img/post27-316085028871083490.png)&#xD;
&#xD;
As the IDE grows in sophistication so will the methods the API supports. For now, though, these provide the most direct control that is possible to get with the IDE.</description>
    <dc:creator>b3m2a1 ​ </dc:creator>
    <dc:date>2019-04-09T10:47:07Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1527021">
    <title>MATH-TWS: Connecting Mathematica to Interactive Brokers TWS</title>
    <link>https://community.wolfram.com/groups/-/m/t/1527021</link>
    <description>MATH-TWS is a new Mathematica package that connects Wolfram Mathematica to the Interactive Brokers TWS platform via the C++ API. It enables the user to retrieve information from TWS on accounts, portfolios and positions, as well as historical and real-time market data. MATH-TWS also enables the user to place and amend orders and obtain execution confirmations from Mathematica.&#xD;
&#xD;
I have wanted a way to connect Wolfram Mathematica to Interactive Brokers Trader Workstation for the longest time.  Now that it is finally available with MATH-TWS  I am excited by the possibilities for Mathematica users.&#xD;
&#xD;
The first release of MATH-TWS will be available within a couple of weeks. Anyone interested in licensing a copy should email algorithmicexecution@gmail.com with MATH-TWS in the subject line.&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
![enter image description here][12]&#xD;
&#xD;
![enter image description here][13]&#xD;
&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=twsConnect.png&amp;amp;userId=773999&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=twsAccounts.png&amp;amp;userId=773999&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=twsAccounts2.png&amp;amp;userId=773999&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=twsAccounts3.png&amp;amp;userId=773999&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=HistoricalData.png&amp;amp;userId=773999&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=DataManipulation.png&amp;amp;userId=773999&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=TimeSeries.png&amp;amp;userId=773999&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=IntradayData.png&amp;amp;userId=773999&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Currentmarketdata.png&amp;amp;userId=773999&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=News.png&amp;amp;userId=773999&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Ordermanagement.png&amp;amp;userId=773999&#xD;
  [12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Modifyorder.png&amp;amp;userId=773999&#xD;
  [13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Cancelorder.png&amp;amp;userId=773999</description>
    <dc:creator>Jonathan Kinlay</dc:creator>
    <dc:date>2018-10-22T12:09:47Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1736686">
    <title>Bayesian linear regression in Mathematica</title>
    <link>https://community.wolfram.com/groups/-/m/t/1736686</link>
    <description>Recently I updated my [Bayesian inference reporitory][1] with a new function called `BayesianLinearRegression` to provide a Bayesian alternative to Mathematica&amp;#039;s `LinearModelFit`. I also submitted the code for this function to the [Wolfram function repository][2] to make it easier to access, so the function can also be used with `ResourceFunction[&amp;#034;BayesianLinearRegression&amp;#034;]`.&#xD;
&#xD;
The example notebook in the repository provides several examples of how the function can be used, some of which I will reproduce below. Please refer to the GitHub README.md file (which is displayed on the homepage of the repository) for instructions about installing the `BayesianInference` package. The code is in [this file][3], in case you&amp;#039;re interested in taking a look under the hood.&#xD;
&#xD;
## Fitting polynomials ##&#xD;
&#xD;
First generate some test data:&#xD;
&#xD;
    data = RandomVariate[&#xD;
      MultinormalDistribution[{{1, 0.7}, {0.7, 1}}],&#xD;
      20&#xD;
    ];&#xD;
    ListPlot[data]&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
The usage of `BayesianLinearRegression` is similar to that of `LinearModelFit` with one significant difference: I decided that the `Rule`-based data specification used by `Predict` and `NetTrain` is often more convenient than the matrix input used by the `Fit` family, so I decided that both types of data specifications should work. The main reason for this is that `BayesianLinearRegression` also supports regression of vector outputs (an example of that is given in the repository example notebook), in which case the `Rule`-based format is often easier to understand.&#xD;
&#xD;
When you fit a model, `BayesianLinearRegression` returns an `Association` containing all relevant information about the fit. Fit a model of the form `y == a + b x + randomness` where `randomness`  is distributed as `NormalDistribution[0, sigma]`. Here, `a`, `b` and `sigma` are unknowns that need to be fitted to the data:&#xD;
&#xD;
    In[20]:= Clear[x];&#xD;
    model =  BayesianLinearRegression[data, {1, x}, x];&#xD;
&#xD;
Below is a more detailed description of the information return by `BayesianLinearRegression`, but let&amp;#039;s first concentrate on the main fit result, which is the [posterior predictive distribution][5] :&#xD;
&#xD;
    In[61]:= model[&amp;#034;Posterior&amp;#034;, &amp;#034;PredictiveDistribution&amp;#034;]&#xD;
    &#xD;
    Out[61]= StudentTDistribution[-0.267818 + 0.986121 x, &#xD;
     0.726105 Sqrt[1.05016 + 0.00692863 x + 0.0635094 x^2], &#xD;
     2001/100&#xD;
    ]&#xD;
&#xD;
As you can see, the result is returned is an `x`-dependent `StudentTDistribution`. Visualize the predictions:&#xD;
&#xD;
    With[{&#xD;
      predictiveDist = model[&amp;#034;Posterior&amp;#034;, &amp;#034;PredictiveDistribution&amp;#034;],&#xD;
      bands = {95, 50, 5}&#xD;
      },&#xD;
     Show[&#xD;
      Plot[&#xD;
       Evaluate@InverseCDF[predictiveDist, bands/100],&#xD;
       {x, -4, 4}, Filling -&amp;gt; {1 -&amp;gt; {2}, 3 -&amp;gt; {2}}, PlotLegends -&amp;gt; bands&#xD;
       ],&#xD;
      ListPlot[data],&#xD;
      PlotRange -&amp;gt; All&#xD;
      ]&#xD;
     ]&#xD;
![enter image description here][6]&#xD;
&#xD;
In the `BayesianInference` package on GitHub, I included a function called `regressionPlot1D` which makes it a bit easier to make this plot:&#xD;
&#xD;
    Show[&#xD;
     regressionPlot1D[model[&amp;#034;Posterior&amp;#034;, &amp;#034;PredictiveDistribution&amp;#034;], {x, -4, 4}, {95, 50, 5}],&#xD;
     ListPlot[data]&#xD;
    ] &#xD;
    (* same result*)&#xD;
&#xD;
## Model comparison and model mixing ##&#xD;
&#xD;
Often you&amp;#039;ll want to compare multiple models against a data set to see which one works best. For example, here is some data where it&amp;#039;s a bit unclear if you should use a first or second order model:&#xD;
&#xD;
    data = {{-1.5`,-1.375`},{-1.34375`,-2.375`},{1.5`,0.21875`},{1.03125`,0.6875`},{-0.5`,-0.59375`},&#xD;
      {-1.875`,-2.59375`},{1.625`,1.1875`},{-2.0625`,-1.875`},{1.0625`,0.5`},{-0.4375`,-0.28125`},{-0.75`,-0.75`},{2.125`,0.375`},{0.4375`,0.6875`},{-1.3125`,-0.75`},{-1.125`,-0.21875`},&#xD;
      {0.625`,0.40625`},{-0.25`,0.59375`},{-1.875`,-1.625`},{-1.`,-0.8125`},{0.4375`,-0.09375`}}&#xD;
    ListPlot[data]&#xD;
![enter image description here][7]&#xD;
&#xD;
Fit the data with polynomials up to fourth degree; rank the log-evidences and inspect them. As you can see, the first and second order fits are almost equally likely:&#xD;
&#xD;
    In[152]:= models = AssociationMap[&#xD;
       BayesianLinearRegression[Rule @@@ data, x^Range[0, #], x] &amp;amp;,&#xD;
       Range[0, 4]&#xD;
       ];&#xD;
    ReverseSort@models[[All, &amp;#034;LogEvidence&amp;#034;]]&#xD;
    &#xD;
    Out[153]= &amp;lt;|1 -&amp;gt; -30.0072, 2 -&amp;gt; -30.1774, 3 -&amp;gt; -34.4292, 4 -&amp;gt; -38.7037, 0 -&amp;gt; -38.787|&amp;gt;&#xD;
&#xD;
Show the prediction bands:&#xD;
&#xD;
    Show[&#xD;
     regressionPlot1D[ models[1, &amp;#034;Posterior&amp;#034;, &amp;#034;PredictiveDistribution&amp;#034;], {x, -3, 3}],&#xD;
     regressionPlot1D[models[2, &amp;#034;Posterior&amp;#034;, &amp;#034;PredictiveDistribution&amp;#034;], {x, -3, 3},  PlotStyle -&amp;gt; Dashed, PlotLegends -&amp;gt; None],&#xD;
     ListPlot[data]&#xD;
    ]&#xD;
![Comparison of the first (solid) and second order (dashed) prediction bands][8]&#xD;
&#xD;
Instead of picking just one of the models, we can define a mixture over all of them. First calculate the weights for each fit:&#xD;
&#xD;
    In[94]:= weights = Normalize[&#xD;
       (* subtract the max to reduce rounding error *)&#xD;
       Exp[models[[All, &amp;#034;LogEvidence&amp;#034;]] - Max[models[[All, &amp;#034;LogEvidence&amp;#034;]]]],&#xD;
       Total&#xD;
       ];&#xD;
    ReverseSort[weights]&#xD;
    &#xD;
    Out[95]= &amp;lt;|1 -&amp;gt; 0.516002, 2 -&amp;gt; 0.47702, 3 -&amp;gt; 0.0068122, 4 -&amp;gt; 0.0000982526, &#xD;
     0 -&amp;gt; 0.0000667854|&amp;gt;&#xD;
&#xD;
Define a mixture of posterior predictive distributions and show the predictions:&#xD;
&#xD;
    In[96]:= mixDist = MixtureDistribution[&#xD;
       Values[weights],&#xD;
       Values@models[[All, &amp;#034;Posterior&amp;#034;, &amp;#034;PredictiveDistribution&amp;#034;]]&#xD;
       ];&#xD;
    Show[&#xD;
     regressionPlot1D[mixDist, {x, -3, 3}],&#xD;
     ListPlot[data]&#xD;
     ]&#xD;
![Prediction bands of a mixture of polynomial models up to degree 4][9]&#xD;
&#xD;
As you can see, if one model is not clearly the best, you can just split the difference between them.&#xD;
&#xD;
Another interesting thing you can do with `BayesianLinearRegression` is Bayesian updating. Basically, this means that if you&amp;#039;ve fitted some data in the past and are now finding new data, you can incorporate the new data by updating your fit without having to re-fit all of the data (old and new) in one go. An example of this is given in the example code notebook on GitHub (in the section about the `&amp;#034;PriorParameters&amp;#034;` options of the function). &#xD;
&#xD;
## Detailed explanation about the returned values ##&#xD;
`BayesianLinearRegression` returns an `Association` with the following keys:&#xD;
&#xD;
    Keys[model]&#xD;
    &#xD;
    Out[21]= {&amp;#034;LogEvidence&amp;#034;, &amp;#034;PriorParameters&amp;#034;, &amp;#034;PosteriorParameters&amp;#034;, &amp;#034;Posterior&amp;#034;, &amp;#034;Prior&amp;#034;, &amp;#034;Basis&amp;#034;, &amp;#034;IndependentVariables&amp;#034;}&#xD;
&#xD;
 - `&amp;#034;LogEvidence&amp;#034;`: In a Bayesian setting, the evidence (also called [marginal likelihood][10]) measures how well the model fits the data (with a higher evidence indicating a better fit). The evidence has the virtue that it naturally penalizes models for their complexity and therefore does not suffer from over-fitting in the way that measures like the sum-of-squares or likelihood do. &#xD;
 - `&amp;#034;Basis&amp;#034;`, `&amp;#034;IndependentVariables&amp;#034;`: Simply the basis functions and independent variable specified by the user.&#xD;
 - `&amp;#034;Posterior&amp;#034;`, `&amp;#034;Prior&amp;#034;`: These two keys each hold an association with 4 distributions: &#xD;
 1. `&amp;#034;PredictiveDistribution&amp;#034;`: A distribution that depends on the independent variables (`x` in the example above). By filling in a value for `x`, you get a distribution that tells you where you could expect to find future `y` values. This distribution accounts for all relevant uncertainties in the model: model variance caused by the term `randomness`; uncertainty in the values of `a` and `b`; and uncertainty in `sigma`.&#xD;
 2. `&amp;#034;UnderlyingValueDistribution&amp;#034;`: Similar to `&amp;#034;PredictiveDistribution&amp;#034;`, but this distribution give the possible values of `a + b x` without the `randomness` error term.&#xD;
 3. `&amp;#034;RegressionCoefficientDistribution&amp;#034;`: The join distribution over `a` and `b`.&#xD;
 4. `&amp;#034;ErrorDistribution&amp;#034;`: The distribution of the variance `sigma^2`.&#xD;
 - ` &amp;#034;PriorParameters&amp;#034;`, `&amp;#034;PosteriorParameters&amp;#034;`: These parameters are not immediately important most of the time, but they contain all of the relevant information about the fit. &#xD;
&#xD;
## Sources ##&#xD;
&#xD;
The formulas underlying BayesianLinearRegression are based mainly on the following Wikipedia articles. The names of the hyper parameters returned by the function are based on the article about multivariate linear regression. &#xD;
&#xD;
 - [Bayesian linear regression (Wikipedia)][11]&#xD;
 - [Bayesian multivariate linear regression (Wikipedia)][12]&#xD;
&#xD;
&#xD;
  [1]: https://github.com/ssmit1986/BayesianInference&#xD;
  [2]: https://resources.wolframcloud.com/FunctionRepository/resources/BayesianLinearRegression&#xD;
  [3]: https://github.com/ssmit1986/BayesianInference/blob/master/BayesianInference/BayesianLinearRegression.wl&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=testdata.png&amp;amp;userId=839741&#xD;
  [5]: https://en.wikipedia.org/wiki/Posterior_predictive_distribution&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=fit.png&amp;amp;userId=839741&#xD;
  [7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=testdata2.png&amp;amp;userId=839741&#xD;
  [8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=fit2.png&amp;amp;userId=839741&#xD;
  [9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=fitmix.png&amp;amp;userId=839741&#xD;
  [10]: https://en.wikipedia.org/wiki/Marginal_likelihood&#xD;
  [11]: https://en.wikipedia.org/wiki/Bayesian_linear_regression&#xD;
  [12]: https://en.wikipedia.org/wiki/Bayesian_multivariate_linear_regression</description>
    <dc:creator>Sjoerd Smit</dc:creator>
    <dc:date>2019-07-14T12:30:33Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1039591">
    <title>Saving data directly in notebooks</title>
    <link>https://community.wolfram.com/groups/-/m/t/1039591</link>
    <description>Do you ever wish you could save data directly into a notebook instead of having to export it?  I sometimes do things like&#xD;
&#xD;
    mydata = {1,2,3, ...};&#xD;
&#xD;
just to be able to use this data next time I open the notebook.  This could be data I pasted from the web, or something that just took several minutes to generate.&#xD;
&#xD;
But saving it like this is inconvenient, and often takes up a lot of space.&#xD;
&#xD;
Today I published a blog post about a better method that I have been using recently.  I thought people here may be interested:&#xD;
&#xD;
 * [Save data directly in Mathematica notebooks](http://szhorvat.net/pelican/save-data-in-notebooks.html)&#xD;
&#xD;
The idea is to use first `Compress` the data, then use `Interpretation` to create a compact display for it.  Here&amp;#039;s a small function that packages all of this up:&#xD;
&#xD;
    ClearAll[SaveToCell]&#xD;
    &#xD;
    SaveToCell::usage =&#xD;
        &amp;#034;SaveToCell[variable] creates an input cell that reassigns the current value of variable.\n&amp;#034; &amp;lt;&amp;gt;&#xD;
        &amp;#034;SaveToCell[variables, display] shows &amp;#039;display&amp;#039; on the right-hand-side of the assignment.&amp;#034;;&#xD;
    &#xD;
    SetAttributes[SaveToCell, HoldFirst]&#xD;
    SaveToCell[var_, name : Except[_?OptionQ] : &amp;#034;data&amp;#034;, opt : OptionsPattern[]] :=&#xD;
        With[{data = Compress[var],&#xD;
          panel = ToBoxes@Tooltip[Panel[name, FrameMargins -&amp;gt; Small], DateString[]]},&#xD;
          CellPrint@Cell[&#xD;
            BoxData@RowBox[{&#xD;
              MakeBoxes[var],&#xD;
              &amp;#034;=&amp;#034;,&#xD;
              InterpretationBox[panel, Uncompress[data]],&#xD;
              &amp;#034;;&amp;#034;&#xD;
            }],&#xD;
            &amp;#034;Input&amp;#034;,&#xD;
            (* prevent deletion by Cell &amp;gt; Delete All Output: *)&#xD;
            GeneratedCell -&amp;gt; False,&#xD;
            (* CellLabel is special: last occrrence takes precedence, so it comes before opt: *)&#xD;
            CellLabel -&amp;gt; &amp;#034;(saved)&amp;#034;,&#xD;
            opt,&#xD;
            CellLabelAutoDelete -&amp;gt; False&#xD;
          ]&#xD;
        ]&#xD;
&#xD;
If you have your data in the variable `var`, simply run `SaveToCell[var]`, which will create an input cell that re-assign the value of `var`. It looks like this:&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
We can also customize the display:&#xD;
&#xD;
    var = Range[1000];&#xD;
    SaveToCell[var, Short[var]]&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
Hovering the display will show the date when the data was saved.&#xD;
&#xD;
`SaveToCell` also takes arbitrary `Cell` options, and passes them down to the generated cell.  Something strange I observed while writing this function is that with some options, such as `CellLabel`, [it is not the first but the last occurrence of the option that takes precedence][3].  Does anyone know why?&#xD;
&#xD;
We can use this functionality to change the cell style, add a different label, or to protect the cell against accidental deletion: `SaveToCell[var, Deletable -&amp;gt; False]`.&#xD;
&#xD;
I have been using this little function for a while, and I hope that others will find it useful too.&#xD;
&#xD;
Do be careful though: notebooks are not designed for storing large data.  I would avoid storing data as large as several tens of megabytes within notebooks.&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=in1.png&amp;amp;userId=38370&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=in3.png&amp;amp;userId=38370&#xD;
  [3]: http://mathematica.stackexchange.com/q/140989/12</description>
    <dc:creator>Szabolcs Horvát</dc:creator>
    <dc:date>2017-03-25T21:56:48Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/963158">
    <title>Draw: vector drawing &amp;amp; technical illustration application</title>
    <link>https://community.wolfram.com/groups/-/m/t/963158</link>
    <description>Recently John Fultz [announced][1] GitLink as open source on GitHub. He also mentioned the desire to offer more Wolfram related open source to the community. Draw was not mentioned by John but readers of his post followed the GitHub [link][2] and discovered the Draw repository. Naturally questions followed so here we are with an introduction of Draw, the latest open source contribution to the community.&#xD;
&#xD;
Draw is a vector drawing application. Many of the technical illustrations found in the Wolfram Language documentation were created using it. The release of Draw is to promote the advantages of using the Wolfram Language for software development.&#xD;
&#xD;
Draw was a personal project that grew from an idea to develop a simple tool to automate the drawing of flowcharts. This simple tool expanded in response to the need of functionality for solving specific challenges required by various illustrations. The Wolfram Language was very instrumental in helping Draw evolve during this process.&#xD;
&#xD;
Some of the more prominent features of Draw include:&#xD;
&#xD;
 - Orthographic 3D drawing&#xD;
 - Circuit, Mechanical and 3D library presets&#xD;
 - Adjustable shapes such as gears or spirals&#xD;
 - Shape arrays&#xD;
 - Image autotrace&#xD;
&#xD;
The gallery of examples below demonstrate the capabilities of Draw:&#xD;
&#xD;
![gallery][3]&#xD;
&#xD;
A look inside the application reveals an interface divided into four distinct sections:&#xD;
&#xD;
![interface sections][4]&#xD;
&#xD;
An example of Draw being used to work on a flowchart:&#xD;
&#xD;
![interface][5]&#xD;
&#xD;
The Circuit, Mechanical and 3D libraries:&#xD;
&#xD;
![libraries][6]&#xD;
&#xD;
The adjustable gear shape:&#xD;
&#xD;
![gear][7]&#xD;
&#xD;
The shape array:&#xD;
&#xD;
![shape array][8]&#xD;
&#xD;
Hope this brief introduction is enough to inspire you to download the Draw notebook from [this GitHub link][9]. Start creating illustrations or explore the Wolfram Language code to discover how the application works. Support is available by clicking the blue help button for topics such as the basics, features, interaction, tools, examples and tips. Tooltips appear for all buttons detailing their behavior. Remember this is open source software and comes with no guarantee. That being said, feel free to kick the tires and take it for a spin.&#xD;
&#xD;
Draw works best when used in Mathematica 11 but most functionality is supported by Mathematica 10.4.1.&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com/groups/-/m/t/960333&#xD;
  [2]: https://github.com/WolframResearch&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=examples.png&amp;amp;userId=28355&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=interfaceSections.png&amp;amp;userId=28355&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=interface.png&amp;amp;userId=28355&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=libraries.png&amp;amp;userId=28355&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=gear.png&amp;amp;userId=28355&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=shapearray.png&amp;amp;userId=28355&#xD;
  [9]: https://github.com/shdlbwr/draw</description>
    <dc:creator>Tim Shedelbower</dc:creator>
    <dc:date>2016-11-14T20:15:12Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1468475">
    <title>PJLink: Hooking up Mathematica and Python</title>
    <link>https://community.wolfram.com/groups/-/m/t/1468475</link>
    <description>Here&amp;#039;s a cross-post of something I originally wrote [here](https://www.wolframcloud.com/objects/b3m2a1/home/pjlink-hooking-up-mathematica-and-python.html) about how to get python and Mathematica to work together like JLink.&#xD;
&#xD;
I thought this might have broad appeal here.&#xD;
&#xD;
PJLink: Hooking up Mathematica and Python&#xD;
---&#xD;
Mathematica is an incredibly powerful platform with a fun and intellectually pleasing language, but is incredibly expensive and closed source. Python is a convenient, pretty powerful language with a lot of support from the developer community. For as long as the two have existed people have been trying to tie them together, but very little has been done to do so at the native level with efficient, convenient exchange between the two. That&amp;#039;s why over the past few weeks I took the time to build a clean, convenient link between the two. This post will go into how the link was built and some of its features, but first I think a little demo is appropriate.&#xD;
&#xD;
&#xD;
&#xD;
## A Quick Demo&#xD;
&#xD;
### Installing PJLink&#xD;
&#xD;
The link is based off of the  [J/Link](https://reference.wolfram.com/language/JLink/tutorial/Overview.html) interface built into Mathematica for hooking up Java and Mathematica. To wit, I called it  [PJ/Link](https://github.com/b3m2a1/PJLink) . It lives on my paclet server as well as GitHub, so we can easily install it from there:&#xD;
&#xD;
    PacletInstall[&amp;#034;PJLink&amp;#034;, &amp;#034;Site&amp;#034;-&amp;gt;&amp;#034;http://www.wolframcloud.com/objects/b3m2a1.paclets/PacletServer&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
![hookingupmathematicaandpython-274752603667507597](https://www.wolframcloud.com/objects/b3m2a1/home/img/hookingupmathematicaandpython-274752603667507597.png)&#xD;
&#xD;
### Loading PJLink in Jupyter&#xD;
&#xD;
For this demo we&amp;#039;ll need the path to this thing as well (note that the version might change in the future):&#xD;
&#xD;
    %[&amp;#034;Location&amp;#034;]&#xD;
&#xD;
    (*Out:*)&#xD;
    &#xD;
    &amp;#034;~/Library/Mathematica/Paclets/Repository/PJLink-1.0.0&amp;#034;&#xD;
&#xD;
Now we&amp;#039;ll leave Mathematica and open up a Jupyter notebook:&#xD;
&#xD;
![hookingupmathematicaandpython-921972091567300718](https://www.wolframcloud.com/objects/b3m2a1/home/img/hookingupmathematicaandpython-921972091567300718.png)&#xD;
&#xD;
Next we&amp;#039;ll get that path available so we can actually make use of the package. Then we&amp;#039;ll load things from the subsidiary  ```SubprocessKernel``` package which is included in the paclet and makes use of PJLink:&#xD;
&#xD;
&amp;lt;pre&amp;gt;import os, sys&#xD;
pjlink_path = &amp;amp;quot;~/Library/Mathematica/Paclets/Repository/PJLink-1.0.0&amp;amp;quot; #this is whatever path was extracted before&#xD;
sys.path.insert(0, os.path.expanduser (pjlink_path))&#xD;
&#xD;
from SubprocessKernel import SubprocessKernel&#xD;
from SubprocessKernel import MathematicaBlock, LinkEnvironment&#xD;
## these are helpers I&amp;amp;apos; ll use in the demo&amp;lt;/pre&amp;gt;&#xD;
&#xD;
![hookingupmathematicaandpython-695494794636171070](https://www.wolframcloud.com/objects/b3m2a1/home/img/hookingupmathematicaandpython-695494794636171070.png)&#xD;
&#xD;
### Bidirectional Communication&#xD;
&#xD;
Once we have this we can start a subprocess kernel which will open a Mathematica front-end to interact with. We&amp;#039;ll also start and evaluator Mathematica can use to call back into python.&#xD;
&#xD;
You may see a long string of output from your C compiler as the setup.py file builds out the native library that PJLink uses. Don&amp;#039;t worry, this should only happen once. If it fails, raise an issue on  [GitHub](https://github.com/b3m2a1/PJLink/issues) so I can deal with it.&#xD;
&#xD;
Once Mathematica has loaded, we&amp;#039;ll use the  ```MathematicaBlock``` context manager so we can write something that looks a lot like Mathematica code and use the  ```MEval``` function we&amp;#039;ll define to run the code. That code for all this looks like:&#xD;
&#xD;
&amp;lt;pre&amp;gt;ker = SubprocessKernel()&#xD;
def MEval (expr, wait = True, kernel = ker) :&#xD;
     &amp;amp;quot;&amp;amp;quot; &amp;amp;quot;MEval evaluates a Mathematica expression in the Mathematica kernel&#xD;
      &#xD;
      &amp;amp;quot; &amp;amp;quot;&amp;amp;quot;&#xD;
    kernel.drain() # just to make sure things are clen&#xD;
    return kernel.evaluate (expr, wait = wait)&#xD;
ker.start()&#xD;
ker.start_evaluator()&amp;lt;/pre&amp;gt;&#xD;
&#xD;
After that we can simply call into Mathematica:&#xD;
&#xD;
&amp;lt;pre&amp;gt;with MathematicaBlock():&#xD;
      res = MEval (Set (M.hi, &amp;amp;quot;Hello from python!&amp;amp;quot;))&#xD;
res&amp;lt;/pre&amp;gt;&#xD;
&#xD;
![hookingupmathematicaandpython-4447232891793681130](https://www.wolframcloud.com/objects/b3m2a1/home/img/hookingupmathematicaandpython-4447232891793681130.png)&#xD;
&#xD;
We can see string  ```&amp;#034;Hello from python!&amp;#034;``` was set to the symbol  ```hi``` on the Mathematica side and was returned back by  ```MEval``` . Symbols that aren&amp;#039;t in the  ```&amp;#034;System`&amp;#034;```  context need to be prefaced by an  ```M.``` as that&amp;#039;s a special class that can resolve symbol names like that.&#xD;
&#xD;
We can also get efficient data transfer of arrays from either side. Here we&amp;#039;ll take some Mathematica data and get it back out on the python side. The first thing we need to do is go to the Mathematica notebook that opened and load the  ```&amp;#034;PJLink`&amp;#034;``` context. Then we&amp;#039;ll install the python runtime that the  ```SubprocessKernel``` object configured. This looks like:&#xD;
&#xD;
    &amp;lt;&amp;lt;PJLink`&#xD;
    InstallPython[ LinkObject-&amp;gt;SubprocessKernel`$PyEvaluateLink, ProcessObject-&amp;gt;None];&#xD;
&#xD;
Once it&amp;#039;s installed, we&amp;#039;ll use it directly via  ```PyEvaluate``` :&#xD;
&#xD;
    With[{arr= RandomReal[{-1, 1}, {50, 50, 50}]},&#xD;
      PyEvaluate[dat=arr]&#xD;
      ]&#xD;
&#xD;
Calls into python are done in an environment held only by the link, so to access that we need to wrap the evaluator we started ( ```ker.evaluator``` ) in a  ```LinkEnvironment``` context manager:&#xD;
&#xD;
&amp;lt;pre&amp;gt;with LinkEnvironment(ker.evaluator):&#xD;
      res = dat.shape&#xD;
res&amp;lt;/pre&amp;gt;&#xD;
&#xD;
![hookingupmathematicaandpython-8804306407173974153](https://www.wolframcloud.com/objects/b3m2a1/home/img/hookingupmathematicaandpython-8804306407173974153.png)&#xD;
&#xD;
Arrays are held as NumPy arrays by default on the python side, although this may be disabled. If disabled, they&amp;#039;re held as a data type called  ```BufferedNDArray``` which holds the data as a single C-contiguous array and allows slicing and viewing into it (although no efficient math or manipulation of any sort).&#xD;
&#xD;
Finally, to close out the demo, we&amp;#039;ll plot something on the Mathematica side and watch it come back on the python side. The code for this should be pretty self-explanatory by this point, but there is one cute feature to note:&#xD;
&#xD;
&amp;lt;pre&amp;gt;with MathematicaBlock():&#xD;
      res = MEval(&#xD;
           Rasterize(&#xD;
                 Plot(Sin (M.x), List (M.x, 0, Times (2, Pi)),&#xD;
                       ImageSize = [250, 250],&#xD;
                       PlotLabel = &amp;amp;quot;sin(x) as plotted in Mathematica&amp;amp;quot;&#xD;
                       )&#xD;
                 )&#xD;
           )&#xD;
res&amp;lt;/pre&amp;gt;&#xD;
&#xD;
Unfortunately it really does matter that we pass a  ```List``` expression instead of a python list for the second argument to  ```Plot``` as otherwise the system hangs for reasons that aren&amp;#039;t totally clear. On the other hand, we can see how nice options passing is in the interface. We make use of the python  ```**kwargs``` setup and that  ```ImageSize= ...``` and  ```PlotLabel= ...``` both get automatically converted into rules (albeit with a  ```String``` key instead of a  ```Symbol``` ). The  ```Rasterize``` is, sadly, similarly necessary as there is currently no logic in the package to automatically convert  ```Graphics``` expression into their rasterized forms. &#xD;
&#xD;
![hookingupmathematicaandpython-6192533434254394386](https://www.wolframcloud.com/objects/b3m2a1/home/img/hookingupmathematicaandpython-6192533434254394386.png)&#xD;
&#xD;
I think we&amp;#039;ll close out the demo here, though, and move onto a description of how this works.&#xD;
&#xD;
&#xD;
&#xD;
## PJLink Native Library&#xD;
&#xD;
The heart of PJLink is the C library that connects a python runtime to MathLink. The source for this can be found  [here](https://github.com/b3m2a1/PJLink/blob/master/PJLink/PJLinkNativeLibrary/src/PJLinkNativeLibrary.cpp) . This library, once compiled by the setup.py file packaged with it, implements the basic MathLink calls in a way that python can use them and attempts to do so with efficient memory usage and data transfer.&#xD;
&#xD;
### Data Sharing in the Native Library&#xD;
&#xD;
The heart of the native library is the set of  ```PutArray``` and  ```GetArray``` functions it implements. Beyond anything else, it is the fast transfer of large arrays of data that makes a C-level connection so appealing. The way we handle this on the python side is via the python  [buffer protocol](https://docs.python.org/3/c-api/buffer.html) . We enforce the condition that all data sent and received on the python side must be handled by an object that can work with a C-contiguous buffer of data. By default this is done with  [NumPy](http://www.numpy.org/) if it is installed, but if not there is a custom object called  ```BufferedNDArray``` in the  [HelperClasses](https://github.com/b3m2a1/PJLink/blob/master/PJLink/HelperClasses.py) package that deals with this.&#xD;
&#xD;
### Threading in the Native Library&#xD;
&#xD;
Python has something called the  [Global Interpreter Lock (GIL)](https://docs.python.org/3/c-api/init.html#thread-state-and-the-global-interpreter-lock) which is a method for synchronizing python state. Unfortunately for us, the presence of the GIL means that standard C calls of the kind we&amp;#039;ll be using will cause all threads to lock. To get around this, every call into the MathLink library in the native library is wrapped in the  ```MLTHREADED``` macro which handles the releasing and reacquiring of the lock. This allows our threads to work once more. Any extensions to the library should keep this in mind.&#xD;
&#xD;
&#xD;
&#xD;
## Class Structures&#xD;
&#xD;
PJLink provides a glut of classes that handle the details communication, so we will quickly detail what the important ones do. More information is always available upon request.&#xD;
&#xD;
### The *Link classes&#xD;
&#xD;
PJLink is based off of JLink and so it makes use of the same kind of class structure that JLink does. This means that it has a  ```MathLink``` class that provides a template for the kind of link we&amp;#039;ll work with and a  ```KernelLink``` class that works specifically with Mathematica kernels. In general, we will only really work with a subclass of a  ```KernelLink``` called a  ```WrappedKernelLink``` that implements the  ```KernelLink``` interface by calling into a  ```NativeLink``` which is the only class which actually touches the native library at all.&#xD;
&#xD;
If one is controlling a Mathematica kernel from python, it will be handled by a  ```WrappedKernelLink``` .&#xD;
&#xD;
### Reader class&#xD;
&#xD;
The  ```Reader``` class handles the other half of the communication. It waits for calls from Mathematica and processes them via the  ```KernelLink._handlePacket``` function. Most commonly these calls in turn call  ```KernelLink.__callPython``` which builds a python call from the symbolic python packet that  ```PyEvaluate``` sends over the link. A  ```Reader``` does its best not to completely prevent its link from passing data  *to* Mathematica, but in general it is best not to depend on this as the  ```NativeLink``` interface allows only a single thread to access the library at once for reasons of safety and stability.&#xD;
&#xD;
### MathLinkEnvironment and MathLinkException&#xD;
&#xD;
The  ```MathLinkEnvironment``` is a standalone class that handles all of the various flags and state that the links need. It centralizes all information about what a given token or flag from MathLink means and provides utility functions for working with this.  ```MathLinkException``` is a subclass of the standard python  ```Exception``` class that handles the MathLink-specific exceptions that are returned. It in turn calls into  ```MathLinkEnvironment``` to learn what various exceptions mean.&#xD;
&#xD;
### MPackage, MLSym, and MLExpr&#xD;
&#xD;
The HelperClasses package provides a large number of (generally) smaller classes that serve to make code cleaner in its implementation. A big part of this is done by the  ```MPackage``` ,  ```MLSym``` , and  ```MLExpr``` classes, which allow for a way to create packets with a syntax that looks more like standard Mathematica code.  ```MLSym``` and  ```MLExpr``` are types that a  ```KernelLink``` knows how to put onto a link and  ```MPackage``` provides utilities and a custom  ```__getattr__``` so that the packet code can look like Mathematica code.&#xD;
&#xD;
### MathematicaBlock and LinkEnvironment&#xD;
&#xD;
Both  ```MathematicaBlock``` and  ```LinkEnvironment``` are also in the HelperClasses. They both edit the current evaluation state as  [context managers](https://docs.python.org/3/reference/datamodel.html#context-managers) so that explicit references to  ```MPackage``` can be dropped and variables held by a given link can be easily accessed. Being context managers, they are both used via  ```with``` statements and change the execution environment of the enclosing block.&#xD;
&#xD;
### BufferedNDArray, ImageData, and SparseArrayData&#xD;
&#xD;
These are all data classes that allow for more efficient and convenient data transfer. The  ```ImageData``` and  ```SparseArrayData``` classes hold data coming in from Mathematica as put using  ```PJLink`Package`AddTypeHints``` . They have methods to efficiently transform to more standard formats like  ```PIL.Image``` and  ```scipy.sparse.csr_matrix``` . As more data types are handled by  ```AddTypeHints``` it can be assumed that more classes like these will be written.&#xD;
&#xD;
&#xD;
&#xD;
## Mathematica-side Package&#xD;
&#xD;
That was all to do with the python side of things, which is where most of the development work had to go. On the other hand, the Mathematica side of the equation still requires some explanation. The package itself is really quite simple, so please feel free to  [peruse the source](https://github.com/b3m2a1/PJLink/blob/master/Mathematica/PJLink.wl) .&#xD;
&#xD;
### InstallPython&#xD;
&#xD;
```InstallPython``` is the most basic function in the package. It either finds or is given a python version or executable, attempts to open it via  ```StartProcess``` , then links to it via  ```LinkCreate``` and the  ```start_kernel.py``` script provided in the PJLink python package.&#xD;
&#xD;
Notably, all it really requires is a  ```LinkObject``` , so you can pass one directly via the  ```LinkObject``` option. It will also by default try to make a python  ```ProcessObject``` but you can pass that via the  ```ProcessObject``` option or you can pass  ```None``` in which case it won&amp;#039;t attach to a Mathematica controlled process.&#xD;
&#xD;
### ClosePython&#xD;
&#xD;
```ClosePython``` is the counterpart to  ```InstallPython``` . It closes an opened python runtime by version or executable. When a new kernel is installed it is added to  ```PJLink`Package`$PythonKernels``` and this is what  ```ClosePython``` looks for to close. &#xD;
&#xD;
### PyEvaluate / PyEvaluateString&#xD;
&#xD;
This is the heart of the package. It takes Mathematica-esque code, converts it into a structure that can be processed by  ```KernelLink.__callPython()``` and sends it over and waits for a response. The conversion is handled by  ```PJLink`SymbolicPython`ToSymbolicPython``` which was originally written for the  [PyTools package](https://github.com/b3m2a1/mathematica-PyTools) . This is the best way to move data to python as things like  ```Image``` objects, packable arrays, and  ```SparseArray``` objects will be moved over intelligently.&#xD;
&#xD;
```PyEvaluateString``` is like  ```PyEvaluate``` , but with the recognition that  ```ToSymbolicPython``` will always be a little bit lacking. It allows one to simply call a string of python code on the link and get the results back.&#xD;
&#xD;
### PyWrite / PyWriteString / PyRead / PyReadErr&#xD;
&#xD;
These are all functions that make use of the fact that when the  ```Reader``` object started it allowed an interactive session to keep running and reading / writing on stdin, stdout, and stderr. The  ```Read``` functions read from stdout and stderr and the write functions write to stdin. The former takes Mathematica code and auto-converts it into a string. The latter simply passes in the given string.&#xD;
&#xD;
&#xD;
&#xD;
## Future Work&#xD;
&#xD;
PJLink 1.0.0, beefy as it already is, should only really be seen as the beginning. My hope is that much more can be done to allow for more native data type transfer and for intelligent communication between the two systems.&#xD;
&#xD;
In my demo I tried to show some of the things that make the interoperation of the two so nice, but I obviously don&amp;#039;t have the breadth of knowledge to know all of the many applications this can be put to. Applications built off of PJLink are always welcome and I&amp;#039;m happy to provide any requisite information and extensions to PJLink to get them built.&#xD;
&#xD;
Alongside that, I think better integration on the Mathematica side is necessary. There is a partial interface for allowing a  ```PythonObject``` structure to hide the details of  ```PyEvaluate``` on the Mathematica side, but this needs work from both ends, first hooking up the  ```Language`MutatationHandler``` interface and then extending the same on the python side. After that, a  ```JavaBlock``` -like setup that allows a link to be opened, used, and cleaned up would be highly useful for sandboxing.&#xD;
&#xD;
Finally, I&amp;#039;m sure there are numerous bugs hiding in the package as it stands. Please find them and let me know about them so they can be worked out.&#xD;
&#xD;
In the meantime, I hope you enjoy PJLink and being able to use my two favorite languages symbiotically.</description>
    <dc:creator>b3m2a1 ​ </dc:creator>
    <dc:date>2018-09-20T09:18:51Z</dc:date>
  </item>
</rdf:RDF>

