Community RSS Feed
http://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag External Programs and Systems sorted by activeAvoid truncated tweets texts when using ServiceExecute?
http://community.wolfram.com/groups/-/m/t/1289820
I use the Twitter command to extract tweets and do some analysis
twitter = ServiceConnect["Twitter", "New"]
listTws = twitter["TweetSearch", "Query" -> "Trump", MaxItems -> 10];
For example, the text of the first tweet can be extracted with
listTws[[1]]["Text"]
whose output is
"RT @BreitbartNews: \"Let\[CloseCurlyQuote]s turn a negative into a
positive... I want them to say, \[OpenCurlyQuote]Look, we are not
profiting off the deaths of children. We..."
The tweet is truncated after "We..." . If I look at the [original tweet][1] (ID 966454631361589249) , the original phrase is completed.
Who can I extract the whole sentence??
Is there a way to avoid to import retweets?? They are the majority and look like "RT @name blabla"
[Here][2] I read that I need to set "tweet_mode=extended". How can I do that with Mathematica?
**UPDATE**I have noticed that the truncated tweets' length is 140, whereas the total length is 280. This may be related to the new feature of twitter. Is there a way to fix it?
[2]: https://twittercommunity.com/t/retrieve-full-tweet-when-truncated-non-retweet/75542/3
[1]: http://%22https://twitter.com/nigel_trump/status/966454631361589249%22Francesco Sgarlata2018-02-21T23:57:16ZConnect to a FileMaker .fmp12 database using DatabaseLink?
http://community.wolfram.com/groups/-/m/t/1289467
Using `DatabaseLink`, Is it possible to connect to and query a FileMaker `.fmp12` database? If so, how?Murray Eisenberg2018-02-21T21:59:27ZAvoid DatabaseExamplesBuild to fail?
http://community.wolfram.com/groups/-/m/t/1289450
In Mathematica 11.2.0.0 (under macOS HighSierra 10.13.3), I'm trying to use `DatabaseLink` with the supplied example databases. Here's what I've done:
<< DatabaseLink`DatabaseExamples`
DatabaseExamplesBuild[]
> JDBC::error: invalid authorization specification - not found: SA
> $Failed[1, DatabaseLink`DatabaseExamples`Package`RestoreException["publisher"]]
What's wrong and how should it be fixed?Murray Eisenberg2018-02-21T21:27:38ZSet up SendMail from Mathematica?
http://community.wolfram.com/groups/-/m/t/1286756
I just worked through the online version of "An Elementary Introduction to the Wolfram Language" with Mathematica running on a Pi Zero W. Amazed to find most things worked on that tiny platform.
There were a few examples of using SendMail in the book that I wasn't able to make work. Yahoo didn't like the mail being relayed through the Wolfram Cloud so I was attempting to configure the SMTP server settings, but can't find the "Preferences > Internet & Mail > Mail Settings" menu suggested by the SendMail::cloudrelay message that appeared in my notebook.
Since it may be important, I am using
pi@raspberrypi:~ $ mathematica --version
11.2
Any help getting this set up would be appreciated.
-- ToddTodd Kroeger2018-02-17T07:40:08ZWorking with SEGY file format for storing geophysical data
http://community.wolfram.com/groups/-/m/t/1283198
## Preamble
Several days ago I found this [question][1] in the Community. I think it interesting theme for discussion.
Because I want to show how you can using the package [CustomImportExport][2]. Something of this article will repeat comments on the previous question, but I want save this post to be a stand-alone tutorial for the package and SEGY in Wolfram Language.
## Downloading
Clone or download this repository **[CustomImportExport][3]** using git (in the terminal or cmd-window):
`git clone https://guthub.com/KirillBelovTest/CustomImportExport.git`
Also you can download repository using green button on GitHub
![download button on GitHub][4]
## Installing
After you can install the package in your system. You may open the file *Installer.nb* and execute this code:
```
SetDirectory[NotebookDirectory[]];
Get["Installer.m"];
```
*Installer.m* - script that will create a new folder in **$UserBaseDirectory**. After this you can call the context *"CustomImportExport`"* from any notebooks.
## Reading SEGY data
Now let try read the .segy-file. For demonstration in the repository exist the file [*"/CustomImportExport/Resources/MarmousiModel.segy"*][5]
If you was installed the package, you may execute following in any notebook:
```
$HistoryLength = 0;
<<CustomImportExport`
SetDirectory[$CustomImportExportDirectory];
marmousiPath = FileNameJoin[{"CustomImportExport", "Resources", "MarmousiModel.segy"}];
marmousiData = CustomImport[marmousiPath, "SEGY"]
(*
Out[..] := SEGYData[{SEGYElement["TextHeader"], SEGYElement[..], ..}]
*)
```
This output contains all data from .segy-file. equivalents of the last line of code:
```
marmousiData = CustomImport[File[marmousiPath], "SGY"];
```
## Working with loaded data
Now we have the variable **marmousiData**. This is a object with type **SEGYData**. For this type
in the package defined special operations. For example you can get same of elements:
```
marmousiData["TextHeader"]
(* Out[..] := SEGYElement["TextHeader", <3200 whitespaces>] *)
```
Similarly, you can get other elements:
1. TextHeader
2. BinaryHeader
3. TraceHeaders
4. Traces
```
marmousiData["BinaryHeader"]
(* Out[..] := SEGYElement["BinaryHeader", {"JobID" -> 0, "LineNumber" -> 0, ..}] *)
marmousiData["TraceHeaders"]
(* Out[..] := SEGYElement["TraceHeaders", {"tracl", ..} -> {{0, 1, ..}, ..}] *)
marmousiData["Traces"]
(* Out[..] := SEGYElement["Traces", {{0.0, 1.0, ..}, ..}] *)
```
I created an additional type for convenience. **SEGYElement** also has additional functionality:
```
marmousiTraceHeaders = marmousiData["TraceHeaders"];
marmousiTraceHeaders[]
(* Out[..] := {"tracl", ..} -> {{0, 1}, ..}
returns list of rules - second element in the marmousiTraceHeaders*)
```
And this will work for all SEGYElement-items `SEGYElement["Name", data][]` - returns internal data of the object.
In addition, the elements have other ways of getting data. For example - getting one of the key from the BinaryHeader (several ways):
```
marmousiBinaryHeader = marmousiData["BinaryHeader"];
marmousiData["BinaryHeader"]["JobID"]
marmousiData["BinaryHeader", "NumberDataTraces"]
marmousiBinaryHeader["NumberOfSamplesForReel"]
marmousiBinaryHeader[{"NumberDataTraces", "NumberOfSamplesForReel"}]
(*
Out[..] := 0
Out[..] := 298
Out[..] := 300
Out[..] := {298, 300}
*)
```
Getting information from the TraceHeaders-element:
```
marmousiTraceHeaders = marmousiData["TraceHeaders"];
marmousiData["TraceHeaders"][All]
marmousiData["TraceHeaders", 1, "gx"]
marmousiTraceHeaders[1 ;; 10, {"gx", "gy"}]
marmousiData["TraceHeaders"][{1, 3}]
(*
Out[..] := {{1, 1, 1, ..}, ..} - returns all data without keys.
Out[..] := 0 - only one value
Out[..] := {{0, 0}, {0, 0}, ..} - mixed span - list of keys and only part of the indexes
Out[..] := {{"tracl" -> 1, ..}, ..} - only 1 and 3 elements
*)
```
And the last data element:
```
marmousiTraces = marmousiData["Traces"];
marmousiData["Traces"][6]
marmousiData["Traces", {1, -1}]
marmousiTraces[1 ;; 10 ;; 2]
(*
Out[..] := {1500., 1500., ..} - first trace
Out[..] := {{1500., 1500., ..}, {..}} - first and last traces
Out[..] := {{1500., 1500., ..}, {..}, ..} - span
*)
```
## Helper Functions
In the package there are several auxiliary functions:
```
?SEGYDescription
(* SEGYDescription[segyData]. represent the text header of the .segy file in a convenient format *)
SEGYDescription[marmousiData]
(* Out[..] := <3200 white spaces. If in the file exist description - function will show it>*)
```
Redefined function **ArrayPlot**:
```
ArrayPlot[marmousiData]
(* equivalent:
ArrayPlot[marmousiData["Traces"]]
ArrayPlot[Transpose[marmousiData["Traces"][]]]
*)
```
![enter image description here][7]
And you can set a new value to key of the TraceHeaders (in the future is will be working for other elements):
```
marmousiData["TraceHeaders", 1, "gx"]
SEGYSetValue[marmousiData["TraceHeaders", 1, "gx"], 1];
marmousiData["TraceHeaders", 1, "gx"]
(* Out[..] := 0 *)
(* Out[..] := 1 *)
```
## Optimization
To convert IBM 32 Float numbers, the compiled function is used. By default, it is compiled into bytecode, but if you have a C-compiler, you can use it. On average, this gives a 2-fold gain in the speed of data import:
```
CustomImport[marmousiPath, "SEGY", "ConvertOptions" -> {"CompilationTarget" -> "C"}]
```
## Delayed Loading SEGY Data
This is a very interesting thing that I realized specifically for working with large files (more RAM available). You can not store such a file in the repository.Therefore, the demonstration will be conducted on the same Marmousi model. The function **CustomImport** has an additional option for calling:
```
(* by default loading has value "Memory" *)
unloadedMarmousiData = CustomImport[marmousiPath, "SGY", "Loading" -> "Delayed"]
(*
Out[..] := SEGYData[{
SEGYElement["TextHeader", ..],
SEGYElement["BinaryHeader", ..],
SEGYElement["TraceHeadersUnloaded", {keys..} ->
{"File" -> <filepath>, "Convert" -> convertfunc, "Bytes" -> 240, "Positions" -> {poslist}}],
SEGYElement["TracesUnloaded", {keys..} ->
{"File" -> <filepath>, "Convert" -> convertfunc, "Bytes" -> tracelength, "Positions" -> {poslist}}]
}]
*)
```
Unloaded elements contain only references to sections of the indexed file,
which allows not storing large amounts of data entirely in memory.
You can get the data with a special loader:
```
CustomDataLoad[unloadedMarmousiData["TracesUnloaded", 1], "SEGY"]
CustomDataLoad[unloadedMarmousiData["TracesUnloaded", {1, 3}], "SEGY"]
CustomDataLoad[unloadedMarmousiData["TracesUnloaded", 1 ;; 3], "SEGY"]
(*
Out[..] := {1500., 1500., ..} - only first trace
Out[..] := {{1500., 1500., ..}, {..}} - traces 1, 3
Out[..] := {{1500., 1500., ..}, {..}, {..}} - traces 1, 2 and 3
*)
```
## Exporting SEGY Data
This was much more difficult than import, but in this package, data export to SEGY is also available. Only exported data must fully correspond to the internal structure of SEGYData. For example you can create the copy of the MarmousiModel:
```
CustomExport[StringReplace[marmousiPath, ".segy" -> "Copy.segy"], marmousiData, "SEGY"]
(* Out[..] := <path to copy> *)
```
P.S. Sorry for my English. I'm ready to answer questions and add features to this article and expand the functionality of the package. Offer your use cases.
[1]: http://community.wolfram.com/groups/-/m/t/1272436
[2]: https://github.com/KirillBelovTest/CustomImportExport
[3]: https://github.com/KirillBelovTest/CustomImportExport
[4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=working-with-segy-1.jpg&userId=937303
[5]: https://github.com/KirillBelovTest/CustomImportExport/tree/master/CustomImportExport/Resources
[6]: http://community.wolfram.com/groups/-/m/t/1272436
[7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=working-with-segy-2.jpg&userId=937303Kirill Belov2018-02-12T11:56:31ZRead SEGY data in Mathematica?
http://community.wolfram.com/groups/-/m/t/1272436
Please I need code/software to read SEGY data in order to input to MathematicaJohn Smith Jr.2018-01-25T17:35:21ZAnalyzing Arduino Sensor Data in a STEM high school classroom
http://community.wolfram.com/groups/-/m/t/1286876
My name is Matthew Green and I team-teach at [Riverpoint Academy (RA)](http://twitter.com/riverptacademy) with Rick Biggerstaff. RA is a public [STEM high school for 9th - 12th graders](https://riverpoint.mead354.org/). This year, Rick and I are creating, and teaching, a new course that we call Computational Laboratory, or CompLab for short.
We describe our course like this:
*“In CompLab, students will develop the skills necessary to make and defend precise arguments through the use of data. Our focus will be on observable and quantifiable relationships involving movement or change. Through personal and collaborative projects, students will use Computational Thinking and technology to make informed and justifiable decisions.”*
## Putting Mathematica, Arduino, and Processing together
```
data = Import[
"/Users/matt/CircuitPlayground-master/SaveSensorData/values.csv"]
data = Select[data, Length[#] == 8 &];
data = Dataset[Map[AssociationThread[First[data], #] &, Rest[data]]]
ListLinePlot[Normal[data[All, "x"]]]
ListLinePlot[Normal[data[All, "y"]]]
ListLinePlot[Normal[data[All, "z"]]]
```
It’s day fourteen of CompLab and we’ve just released [an activity](https://docs.google.com/document/d/1drsSyPQq9YwPwmbJpVNX0cIDQY42WEAI1_TWV36Ubzc/edit) to our students that brings Arduino data into Mathematica so they can begin to analyze it in their first attempt to make and defend a claim with data. Up until now students have spent no less than one hour in Mathematica, [just poking around.](https://docs.google.com/document/d/1CvkZGASSInMbWGjpR1frf8H5lUDaVaGN0v0_v8xFK6c/edit) This will be their first attempt at connecting our CompLab tech stack (Mathematica, [Arduino](https://www.arduino.cc/) and [Processing](https://processing.org/)) to their study of rhetoric. As you can see from this [first activity](https://docs.google.com/document/d/1drsSyPQq9YwPwmbJpVNX0cIDQY42WEAI1_TWV36Ubzc/edit), our expectations of **claim** and **justification** are small, but that’s intentional. At Riverpoint Academy we’re all about giving students the chance to incubate skills needed as they move forward. We noticed last semester that many students struggled with even making a claim, so we thought it made sense to isolate that skill from the rest of the details of rhetoric at this time. This was especially important because managing the tech stack is a big challenge for many of our students this early in the course.
Mathematica is [perfectly capable](http://reference.wolfram.com/language/ref/device/Arduino.html) of communicating directly with **microcontrollers** like Arduino, so why not do that? Well, we will, just not yet. (Skip to the final section to read more) Our reasons for **not** starting there are pedagogical. Many of our students are apprehensive about reading and writing code, and we have found that Processing is a fantastic way to get started. Processing then gives purpose to Arduino and together they create the need for deeper analysis of Arduino data. We’ve seen that once students see what’s possible with the Wolfram Language, they are hooked.
## How we got started
![!\[\](Wolfram%20Community%20Arduino%20&%20Mathematica/3000-07.jpg)][1]
Many of our students are new to programming and we need to bring them up to speed quickly so we can engage in some deep [Computational Rhetoric](https://docs.google.com/document/d/1MGkbNDlLvoZ42vL-LKUjZEEu43AEysxxz6uJgvUcS3k/edit?usp=sharing) work.
In our first [activity](https://drive.google.com/open?id=1IVqpE-Hi3d4tDNAQXW7VAVSBKpOee0r4Y8ok1adNtrI), we asked students to create a [Piet Mondrian](https://www.google.com/search?safe=strict&biw=1680&bih=892&tbm=isch&sa=1&ei=sBSGWpzUOs3IjwPR_pKgAg&q=piet+mondrian+art&oq=piet+mondrian+art&gs_l=psy-ab.3..0l10.5662.5964.0.6111.4.4.0.0.0.0.90.276.4.4.0....0...1c.1.64.psy-ab..0.4.274...0i67k1.0.jVsAmxitC6Q) inspired piece using Processing (Java). We then introduced them to [Rhetoric](https://docs.google.com/document/d/1sZMUcfbUNZYs4dVTLHc8JYLB0rukdVjO4MvBOUEM-Iw/edit) and then some [Logical Fallacies](https://docs.google.com/document/d/1Vap0S-rInLrn4YIDQwrN_s7_9lXWGt92wRd4m4L9D1k/edit). Next we asked them to create a Drawing Program in Processing ([Chapter 8](https://www.sparkfun.com/products/13313)), which created the opportunity to introduce a special little Arduino, the [Adafruit Circuit Playground.](https://www.adafruit.com/product/3000?gclid=CjwKCAiAn5rUBRA3EiwAUCWb2xoaD_7VmxvPp5avAEURTuiQRF8ibjtvCaHnmLNRhvhFUPGlbLzyAhoCfEYQAvD_BwE) We are using the Circuit Playground and its many sensors so that students have the opportunity to use data they have collected from their environment to control output on screen. If our only goal were [Physical Computing](https://en.wikipedia.org/wiki/Physical_computing), we would be quite content with what’s possible when you put Arduino and Processing together… but we're interested in [exploring data more deeply](https://docs.google.com/document/d/1YK_Be_yFGThWfCDNDNgy-m1mdOejub4Q85-wcrw6iwA/edit)
## How Mathematica will take center stage
```
(* connect to the device as serial *)
playground =
DeviceOpen["Serial", {"/dev/cu.usbmodem14511", "BaudRate" -> 9600}]
(* make list to hold data *)
Dynamic[dataList];
ReadPlayground[deviceName_] :=
StringSplit[
FromCharacterCode[
DeviceReadBuffer[deviceName, "ReadTerminator" -> "\n"]],
{"\t", "\r"}]
(* getter functions *)
GetXVals[list_] := ToExpression /@ Downsample[Flatten[dataList], 8]
GetYVals[list_] :=
ToExpression /@ Downsample[Drop[Flatten[dataList], 1], 8]
GetZVals[list_] :=
ToExpression /@ Downsample[Drop[Flatten[dataList], 2], 8]
GetLeftButton[list_] :=
ToExpression /@ Downsample[Drop[Flatten[dataList], 3], 8]
GetRightButton[list_] :=
ToExpression /@ Downsample[Drop[Flatten[dataList], 4], 8]
GetLightSensor[list_] :=
ToExpression /@ Downsample[Drop[Flatten[dataList], 5], 8]
GetSoundSensor[list_] :=
ToExpression /@ Downsample[Drop[Flatten[dataList], 6], 8]
GetTempSensor[list_] :=
ToExpression /@ Downsample[Drop[Flatten[dataList], 7], 8]
```
We’ve done a bit of work to [create our own](https://www.wolframcloud.com/objects/bfdcf93b-1e74-49c7-8dc9-0a32338ca563) Wolfram Language interface to the Circuit Playground. As long as [this sketch](https://github.com/matthewalangreen/CircuitPlayground/blob/master/Arduino-allSensors/Arduino-allSensors.ino) is running on the attached Circuit Playground, you can collect live data from it, via the [WL Serial](http://reference.wolfram.com/language/ref/device/Serial.html) interface. We chose to make our own serial connection to take advantage of the awesome Circuit Playground sensor functions [defined here](https://github.com/adafruit/Adafruit_CircuitPlayground/blob/master/Adafruit_Circuit_Playground.h). We traded low-level control for easy access to lots of sensor data.
Our CompLab work culminates in a Computational Essay, inspired by Stephen’s [post](http://blog.stephenwolfram.com/2017/11/what-is-a-computational-essay/), but more directed at the traditional Argumentative Claim standards for our [lower](http://www.corestandards.org/ELA-Literacy/W/9-10/1/b/) and [upper](http://www.corestandards.org/ELA-Literacy/W/11-12/1/b/) students. We’ve co-opted the name Computational Rhetoric, by which we intend **“Rhetoric”** to be **“X”** in [Stephen’s belief](http://blog.stephenwolfram.com/2016/09/how-to-teach-computational-thinking/) that there should be a “Computational X.” That is, we are exploring Rhetoric in a computational way, using uniquely powerful tools like Mathematica to get and make sense of data to write, present and speak convincingly. We’ve told our students that we will define Computational Rhetoric thusly, “using data, and data visualizations to write, speak, and present in a convincing way.”
Though we plan to significantly edit [this activity](https://docs.google.com/document/d/1MGkbNDlLvoZ42vL-LKUjZEEu43AEysxxz6uJgvUcS3k/edit), we share it as an example of where we are headed with our CompLab students. The Wolfram Language makes it possible for our students to pull together subjects that are often kept separate in the traditional high school. CompLab students study Physics, Rhetoric and Computer Science in a coherent and interconnected way because it gives purpose and context for each skill and concept.
## If you’ve made it this far…
Thanks for reading! I’d love to hear your thoughts and ideas for improvement.
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=3.jpg&userId=1285786Matthew Green2018-02-17T23:00:34ZMathematica 11.0.1 now available for the Raspberry Pi
http://community.wolfram.com/groups/-/m/t/1028536
Hi all,
Mathematica 11.0.1 is now available for the Raspberry Pi on Raspbian. If you already have Mathematica installed on your Raspberry Pi, you can update with the following:
sudo apt-get update && sudo apt-get upgrade wolfram-engine
If you don't already have Mathematica installed you can run the following commands to install it:
sudo apt-get update && sudo apt-get install wolfram-engine
New features for the Raspberry Pi include :
- Neural Network features including constructing custom nets : http://reference.wolfram.com/language/guide/NeuralNetworks.html
- Audio processing features including out of core streaming of large sounds as well as advanced audio processing : http://reference.wolfram.com/language/guide/AudioProcessing.html
- Travel based path plan functions including path finding from one city to another : http://reference.wolfram.com/language/guide/LocationsPathsAndRouting.html
- Channel based communication for sending and receiving messages : http://reference.wolfram.com/language/guide/Channel-BasedCommunication.html
- Powerful and easy scripting through WolframScript : http://reference.wolfram.com/language/ref/program/wolframscript.html
- And many more : http://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn11.html
Additionally, with the new release of WolframScript on the Raspberry Pi, you can install WolframScript standalone and run it without a local kernel against the cloud using the `-cloud` option. This means you can use the Wolfram Language through WolframScript on the Raspberry Pi without having wolfram-engine installed by running it against the cloud. See the documentation page for WolframScript for more details.Ian Johnson2017-03-09T21:02:49Z