Search the Community

Showing results for tags 'python'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • Add-on Boards
    • Scopes & Instruments
    • LabVIEW
    • FRC
    • Other
  • General Discussion
    • Project Vault
    • Learn
    • Suggestions & Feedback
    • Buy, Sell, Trade
    • Sales Questions
    • Off Topic
    • Educators
    • Technical Based Off-Topic Discussions

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 38 results

  1. Hi there, Until here, I've done quite a few things, with the magnificient help of attila. I've done a lot a threads that can use the AD2 to record the analog inputs, or the digital inputs, that can configure the analog outputs or the digital outputs. When I run all of those threads together, it works perfectly fine (except for the tick of my PC, that doesn't allow me to be really fast with the digital outputs, but it's not a big problem for the moment). And then, the UART appeared. I have to say, it works great. The problem is with the UART and the digital outputs. When both are asked (for example logic '1' to DIO 0 and send "This is just a simple test to know if everything works fine" on the Tx at the <<same>> time, the DIO will wait for the end of the UART Transmit). I've tested with with another configuration for the digital output (pulse at 1kHz), and the AD2 stops the pulse when the UART appears. Is it normal or do I do something wrong? Thanks for your help Marc
  2. Hello Digilent Forums, I have an Analog Discovery 2 + Impedance Analyzer board, and have been programmatically manipulating the board via the DWF library. I am now trying to plot Input Phase (∠) programmatically. The SDK for Python comes with a ``, which houses values of `c_int()`, corresponding with various measurement types. For example, `DwfAnalogImpedanceImpedance` measurement type corresponds to `c_int(0)`. I do not see a constant for Input Phase inside ``. Is it possible to get Input Phase? Thank you in advance for your help!
  3. Greetings, Forgive me, but I'm not that knowledgeable in python and I'm having trouble understanding the "create_string_buffer" argument in the sample code. How do you declare this "create_string_buffer" statement into its VB6 equivalent? Sincerely yours, Lesiastas
  4. Hello Digilent Forums, I am trying to write a Python script for the impedance analyzer. I am reading the WaveForms SDK and following examples. I noticed all methods in the examples that use the dwf (Ex: `dwf.FDwfDeviceOpen`) use positional arguments. In the SDK, it lists the parameter names/types for the method (Ex: `FDwfDeviceOpen(int idxDevice, HDWF *phdwf)`). I have tried and failed to figure out how to specify them using keyword arguments instead. Is it possible? Thank you in advance for your help!
  5. Hello, I'm using the AD2 and would like to use Python to play an imported signal of arbitrary length (like in the function AnalogOut_Play) while at the same time acquiring data (like in the function AnalogIn_Record). Is there a straightforward way of combining these two functions?
  6. Hi, I combined a few python scripts from the SDK (AnalogIn_Acquisition, AnalogOut_Play and AnalogOut_Sine) to write a script which is intended to run during the night and save the scope's data into a WAV file. All looks somewhat okay, but there are a few things that don't look perfect. For this test, I connected CH1 and W1 and started both the Scope and Signal generator in the script. I'm intending to generate a 80 Hz sine wave and record it with the scope running at 8 kHz. I attach the whole script, and here are the important parts: # set up signal generation channel = c_int(0) # use W1 dwf.FDwfAnalogOutNodeEnableSet(hdwf, channel, AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, channel, AnalogOutNodeCarrier, funcSine) # ! this looks like a square wave dwf.FDwfAnalogOutNodeFrequencySet(hdwf, channel, AnalogOutNodeCarrier, c_double(signalgenhz)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, AnalogOutNodeCarrier, c_double(1.41)) # ! this doesn't really do anything dwf.FDwfAnalogOutNodeOffsetSet(hdwf, channel, AnalogOutNodeCarrier, c_double(1.41)) I played around with the parameters and after some investigation with Audacity it seems like the funcSine parameter generates a square wave and the amplitude is always 1.0 no matter what I set. The other problem I have is with the FDwfAnalogInStatusData function, it looks like it doesn't just get the raw data from the scope, is contains something else. So in order to get the scope's CH1 data, I need to have a 2-channel WAV file, and discard its first channel. The second is the data I'm looking for. waveWrite =, "wb"); waveWrite.setnchannels(2); # 2 channels for the testing (1 channel would be enough if FDwfAnalogInStatusData returned only 1 channel's data waveWrite.setsampwidth(4); # 32 bit / sample waveWrite.setframerate(samplerate); waveWrite.setcomptype("NONE","No compression"); dwf.FDwfAnalogInStatusData(hdwf, 0, rgdSamples, buffersize) # get channel 1 data CH1 - ! it looks like 2 channels get read here and only the second is the data of CH1 waveWrite.writeframes(rgdSamples); I would expect that if I only need the CH1 of the Scope, I could save it into a mono WAV file.
  7. Hi, I have been using the Waveforms in Mac to control digital discovery. And I am now familiar with using the scripts in Waveforms. I want to use Tool.start option to run python from Waveforms. Below is the command I am using based on the format. But I haven't been successful with running python. Tool.start("/Users/venkatap/anaconda2/bin/python", "/Users/venkatap/Waveforms_v1/py_files/","/tmp/") As all the examples and discussions about this topic are related to windows machine, I wanted to know how to use the Tool.start option in Mac. Kindly assist me with this. Thank you, Praveen
  8. Hi all, I am working on SPI transceiver with AD2 in master mode. I am using python sample codes provided. transmitting is working fine but in receiving i am able to get the signals on wire but not to the variable in python rgwRX = (c_uint16*1)() while True: dwf.FDwfDigitalSpiSelect(hdwf, c_int(4), c_int(0)) dwf.FDwfDigitalSpiRead16(hdwf, c_int(2), c_int(24),rgwRX, c_int(len(rgwRX))) dwf.FDwfDigitalSpiSelect(hdwf, c_int(4), c_int(1)) print rgwRX[0] I am getting only '0's corresponding signal while receiving tapped on CRO is attached and it is proper but when i try it using Waveforms software it works but i see same signal on wire
  9. Hi all i am using Analog discovery 2 for communication purpose.(CAN) I tried using the sample code given same as attached. I am using PCAN to send/receive frames to analog discovery 2 , I am sending only one frame with Standard ID : 0x011 and Data: 0xaa 0xbb 0xcc 0xdd 0xee 0xff but i am receiving lot of Frames with the same ID sent, lot of extended remote frames with CRC errors ,etc. I have attached the console output for reference. Can I know why i am facing the issue? I tried same experiment with waveforms still having similar issue. I have attached the screen shot of it. CAN_Console.txt
  10. I am using analog discovery 2 to send/Receive signals with PCAN using python. Do i need to have a CAN transceiver IC to convert from CAN-H/L to CAN-Rx/Tx? Also wanted to know if i use Waveforms software, what is the hardware connection?
  11. Hello, I have some problems with jitter with analog discovery 2 during acquisition with a python script. I used both (after parsing with futurize to comply with python 3.5) and a modified version using ScanScreen as acquisition mode (see attachment). The last one can run much faster than the suggested I can reach 1MHz sampling rate. """ DWF Python Example Author: Digilent, Inc. Revision: 10/17/2013 Requires: Python 2.7, numpy, matplotlib python-dateutil, pyparsing """ from __future__ import division from __future__ import print_function from builtins import range from past.utils import old_div from ctypes import * from dwfconstants import * import math import time import matplotlib.pyplot as plt import sys from scipy.fftpack import fft import numpy as np if sys.platform.startswith("win"): dwf = cdll.dwf elif sys.platform.startswith("darwin"): dwf = cdll.LoadLibrary("/Library/Frameworks/dwf.framework/dwf") else: dwf = cdll.LoadLibrary("") #declare ctype variables hdwf = c_int() sts = c_byte() hzAcq = c_double(1000000) hzGen = c_double(1000000/8) nSamples = 1000000 rgdSamples = (c_double*nSamples)() #rgdSamples16 = (c_short*nSamples)() pidxWrite = c_int() acqMode = acqmodeScanScreen filterMode = filterAverage #print DWF version version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: "+version.value.decode("utf-8")) #open device print("Opening first device") dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) if hdwf.value == hdwfNone.value: szerr = create_string_buffer(512) dwf.FDwfGetLastErrorMsg(szerr) print(szerr.value.decode("utf-8")) print("failed to open device") quit() print("Preparing to read sample...") print("Generating sine wave...") dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, hzGen) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(2)) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) #set up acquisition dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5)) dwf.FDwfAnalogInAcquisitionModeSet(hdwf, acqMode) dwf.FDwfAnalogInFrequencySet(hdwf, hzAcq) dwf.FDwfAnalogInChannelFilterSet(hdwf, c_int(0), filterMode) bufferLength = 8192 dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(bufferLength)) sts = c_int() dwf.FDwfAnalogInBufferSizeGet(hdwf, byref(sts)) print("Buffer length ", sts.value) bufferLength = sts.value #wait at least 2 seconds for the offset to stabilize time.sleep(2) #begin acquisition dwf.FDwfAnalogInConfigure(hdwf, c_int(0), c_int(1)) print(" waiting to finish") #time.sleep(0.1) cSamples = 0 sts = c_ubyte() cSamplesValid = c_int() idx = 1 pidxWrite = c_int() iterations = 1; while cSamples < nSamples: # Count iterations iterations += 1 dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) # print(sts.value) if cSamples == 0 and (sts == DwfStateConfig or sts == DwfStatePrefill or sts == DwfStateArmed) : # Acquisition not yet started. continue # Read index dwf.FDwfAnalogInStatusIndexWrite(hdwf, byref(pidxWrite)) # Calculate how many new samples are in the buffer availableSamples = (pidxWrite.value - idx)%(bufferLength) if cSamples + availableSamples > nSamples : availableSamples = nSamples-cSamples if idx + availableSamples <= bufferLength: dwf.FDwfAnalogInStatusData2(hdwf, c_int(0), byref(rgdSamples, sizeof(c_double)*cSamples), c_int(idx), c_int(availableSamples)) cSamples += availableSamples #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples, ", cSamples: ", cSamples) idx = pidxWrite.value else: #print("wrapping") #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples) availableSamples1 = bufferLength-idx dwf.FDwfAnalogInStatusData2(hdwf, c_int(0), byref(rgdSamples, sizeof(c_double)*cSamples), c_int(idx), c_int(availableSamples1)) cSamples += availableSamples1 #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples1, ", cSamples: ", cSamples) idx = 0 availableSamples2 = availableSamples-availableSamples1+1 dwf.FDwfAnalogInStatusData2(hdwf, c_int(0), byref(rgdSamples, sizeof(c_double)*cSamples), c_int(idx), c_int(availableSamples2)) cSamples += availableSamples2 #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples2, ", cSamples: ", cSamples) idx = pidxWrite.value #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples, ", cSamples: ", cSamples) print("Recording finished") # Close device dwf.FDwfDeviceCloseAll() # rgpy=[0.0]*len(rgdSamples) for i in range(0,len(rgpy)): rgpy[i]=rgdSamples[i] # Plot plt.figure(1) plt.clf() plt.plot(rgpy, '.') # Plot fft a = np.array(rgpy) A = fft(a)/len(a) plt.figure(2) plt.clf() plt.semilogy(abs(A)) The problem however is not the speed, but the jitter which can be seen by the fft plot or by the drift of the lines in the standard plot when hzGen is a small sub-multiple of hzAcq (see figure). There is a 50 mV drift in 1 s. Is this depending on python code and on the host pc (ubuntu 16.04) or is implicit in the device? I would not expect such a large jitter from this kind of hardware. Is there a way to improve? Thank you in advance for the kind help. Best, Alberto
  12. I have a embedded device which has live waveforms steaming based on the data given to device via simulator. Can you guys pls suggest how can i automate that waveforms using python/Squish tool.Its urgent. Pls reply if you have any thoughts regarding this.
  13. Hi All, I have a embedded device which has live waveforms steaming based on the data given to device via simulator. Can you guys pls suggest how can i automate that waveforms using python/Squish tool.Its urgent. Pls reply if you have any thoughts regarding this.
  14. can we use output from python code in verilog on pynq board. e.g if we take hdmi in python. Can we process that frames in verilog.? Thanks
  15. I had a working Debian 8 production system using python2.7 to talk to an Analog Discovery 2. I decided to update the .deb packages to be current and now I get "Segmentation fault" "stack smashing detected" when I try to start my python program. I was using the amd64.deb files: digilent.adept.runtime 2.16.6 digilent.waveforms 3.5.4 (for the file) Upgraded to digilent.adept.runtime 2.17.1 digilent.waveforms 3.7.5 Also on the system is digilent.adept.utilities 2.2.1. I tested just upgrading the runtime package and my program works. Upgrading the waveforms package (and thus causes the segfault. Any thoughts on how I might track down where the problem is?
  16. I'm writing an I2C interface in python in order to get a real-time stream from a peripheral device and do some additional processing. I have been able to get everything set up such that my peripheral ACKs my request. However, I'm curious for what your strategy is for handling the next packet depending on ACK/NACK. Originally I was just using a digital read at the start of the transmit (Start + Address) and processing the response to detect ACK, then setting up the device for the next transmit (data). However, the USB back/forth is way too slow, so I'm assuming you set everything up in advance in Waveforms I2C to trigger on an ACK. I tried a few methods of setting the output to trigger from I/O states, but I haven't been able to get it to work quite right (is there a way to force a trigger?). Can you briefly explain the general flow for how you set the AD2 up to handle I2C as master in Waveforms? Thanks, Kyle
  17. Hi all, actual i try to transfer a data stream from the DMA via uart to my PC. In my design an DDS-compiler generates a 32bit sine wave, which should be transfered via uart and read by a python script. The general data transfer works, but sometimes i get some noisy signal. This signal happens also when using a lower sample rate. For the uart data transfer actual i did not add any marker where the 32 bit value begins or ends. So i expect this is the problem, but i don't know how to include this in my SDK and python code. Maybe any suggestion? (The FPGA design is similar to my previous post using the Cmod A7) Plot of the result with pyqtgraph: SDK code: int XAxiDma_Poll_Uart(u16 DeviceId) { int Status, Index; int Tries = NUMBER_OF_TRANSFERS; u32 *RxBufferPtr; u32 *RxPacket; u8 BytesSent; RxBufferPtr = (u32 *) RX_BUFFER_BASE; RxPacket = (u32 *) RX_BUFFER_BASE; for (Index = 0; Index < MAX_PKT_LEN_WORDS; Index ++) { RxBufferPtr[Index] = 0xCC; } /* Flush the SrcBuffer before the DMA transfer, in case the Data Cache is enabled*/ Xil_DCacheFlushRange((u32)RxBufferPtr, MAX_PKT_LEN); Status = XAxiDma_SimpleTransfer(&AxiDma, (u32) RxBufferPtr, MAX_PKT_LEN, XAXIDMA_DEVICE_TO_DMA); if (Status != XST_SUCCESS) {return XST_FAILURE;} while (XAxiDma_Busy(&AxiDma, XAXIDMA_DEVICE_TO_DMA)) {/* Wait*/} /* Invalidate the TestBuffer before receiving the data, in case the Data Cache is enabled*/ Xil_DCacheInvalidateRange((u32)RxPacket, MAX_PKT_LEN); //send data to uart BytesSent = XUartLite_Send(&UartLite, RX_BUFFER_BASE, sizeof(RxPacket)); while (XUartLite_IsSending(&UartLite)) {/*Wait*/} return XST_SUCCESS; } Python code: import numpy as np import sys import serial buffersize = 512 byte_number = 4 ser = serial.Serial( port='COM6',\ baudrate=921600,\ parity=serial.PARITY_NONE,\ stopbits=serial.STOPBITS_ONE,\ bytesize=serial.EIGHTBITS,\ timeout=0) for u in range(20): #read serial buffer s = #convert to integer for i in range (int(len(s)/byte_number)): res_value = dataSerial[(i*byte_number):((i+1)*byte_number)] value = int.from_bytes(res_value, byteorder='little', signed = True) dataSerialFormated = np.append(dataSerialFormated, value)
  18. Hi! My goal is to use the Analog Digital 2 in order to move a piezoelectric via stick slip motion. I want to program this into a python script so that I can move the stage one step, record data for x amount of time, move the stage one step, record data, etc. In order to do this, I want to output a specific number of sawtooth wave periods (one to two) at a certain frequency. From these posts ( ,, I have figured out how to do this through the GUI. I have also followed the example scripts and can output standing wave forms, just not pulses. So now, I am looking for some guidance in putting these together. Can you give me some suggestions, advice, or code snippets that might allow me to accomplish this? Are there any functions in the dwf module that might work? Any help is welcome and appreciated! Thanks, Harry digilentScreenCap
  19. Hello, I may have a bug to report. It appears that the latest version of Waveforms 3 on Windows 7 and 8 does not support the python hooks and API. I have rolled my version back to the previous version and it appears to work fine. We just wanted to make sure to bring this to light as it hopefully will not continue through future versions of Waveforms. Thanks, Dylan
  20. Hi, I am trying to do some test automation on the electronics explorer board. I have been looking through the Javascript and Python documentation and haven't been able to find a good mapping of values passed to the API's and where they correspond to the on-board resources. Does one exist? I have really been struggling for example trying to enable/change power supplies. Have variable Vp/Vn values and Vcc (on/off/5v/3.3v). Thank you for your time! Dylan
  21. I want to be able to output a .wav file. I can output a sine wave just fine from python, but I'm having trouble with this. I am loading the wav file. The array is populated. I've been looking for a funcPlay example, but I have not found any. I am able to import the file into waveforms and send it out using play. Thanks. import numpy as np import import matplotlib.pyplot as plt import ctypes import winsound from ctypes import * import time from dwfconstants import * import sys rate, data ='/Users/don/1.wav') plt.plot(data) sin_data = np.sin(data) if sys.platform.startswith("win"): dwf = cdll.dwf elif sys.platform.startswith("darwin"): dwf = cdll.LoadLibrary("/Library/Frameworks/dwf.framework/dwf") else: dwf = cdll.LoadLibrary("") # declare ctype variables hdwf = c_int() channel = c_int(1) # print DWF version version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: {}".format(version.value)) # open device print("Opening first device...") dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) c_double_p = ctypes.POINTER(ctypes.c_double) data_p = data.ctypes.data_as(c_double_p) if hdwf.value == hdwfNone.value: print("failed to open device") quit() print("Generating audio...") print("Configure and start first analog out channel") print("Generating custom waveform...") dwf.FDwfAnalogOutNodeEnableSet(hdwf, channel, AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, channel, AnalogOutNodeCarrier, funcPlay) dwf.FDwfAnalogOutNodeDataSet(hdwf, channel, AnalogOutNodeCarrier, data_p, data.size) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, channel, AnalogOutNodeCarrier, 44100) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, AnalogOutNodeCarrier, c_double(2)) dwf.FDwfAnalogOutConfigure(hdwf, channel, c_bool(True)) dataLost = c_int(0) dataFree = c_int(0) dataCorrupted = c_int(0) psts = c_int(0) dwf.FDwfAnalogOutNodePlayStatus(hdwf, channel, AnalogOutNodeCarrier, dataFree, dataLost, dataCorrupted) dwf.FDwfAnalogOutStatus(hdwf, channel, psts) print("psts: {}".format(psts)) print("dataLost: {}".format(dataLost)) print("dataFree: {}".format(dataFree)) print("dataCorrupted: {}".format(dataCorrupted)) while psts != DwfStateDone: dwf.FDwfAnalogOutNodePlayStatus(hdwf, channel, AnalogOutNodeCarrier, dataFree, dataLost, dataCorrupted) dwf.FDwfAnalogOutStatus(hdwf, channel, psts) dwf.FDwfAnalogOutNodePlayData(hdwf, channel, AnalogOutNodeCarrier, data_p, data.size) # if state == c_int(0): # print("state is 0") # dwf.FDwfAnalogOutNodePlayData(hdwf, channel, AnalogOutNodeCarrier, data_p, data.size) # print("Configure and start first analog out channel") # dwf.FDwfAnalogOutEnableSet(hdwf, c_int(0), c_int(1)) # print("1 = Sine wave") # dwf.FDwfAnalogOutFunctionSet(hdwf, c_int(0), c_int(1)) # dwf.FDwfAnalogOutFrequencySet(hdwf, c_int(0), c_double(3000)) # print("") # dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1)) time.sleep(10) print("done.") dwf.FDwfDeviceClose(hdwf)
  22. Hello, I'm starting to work with custom scripts on my discovery 2 (with oscilloscope extension + probes). I'm trying to setup a measurement environment using the sample script. I have a power supply with output voltage at 4V. When I run the scope at WaveForms I get 4V reading, however, when I run the acquisition script I get 2.72V as average voltage. I also tried with the script and also get 2.73V. I wonder why such different results. Pictures bellow:
  23. After going through a range of the SDK examples, I'm running into some strange behavior that I'm hoping someone can help explain. The result I'm trying to achieve is sending out a low duty cycle pulse (Digital or Analog but something similar to a TTL) that triggers the repeated acquisition on the Analog Discovery. I can achieve this result using the GUI but would like to insert this process into a python script so I can process and save the data. When I route W1 into CH1 in the following example what I see is expected. However, when I try to route the digital out into CH1 things look extremely wonky. Again, I'd like to see a waveform that would be considered a PWM waveform that has a duty cycle of ~99% low and I'd like to be able to control that duty cycle with a reasonable degree of precision and accuracy. Any help would be appreciated and hope the solution is easy as I've been staring at this entirely too long. Am I just trying to put too many points into the digital out? Another potential solution that I'm not entirely sure how to implement, is loading a custom waveform from a file and running that through the waveform generator. Is there an example for that that would also fit with the DAQ needs? Cheers, Brian
  24. Hi Everyone! I'm currently working on an automated tester and instead of having someone write commands on a terminal emulator (Tera Term) I'd like to run a python script to do so. I've looked through the reference material and the "File()" commands are only used to read or write to texts files. Are these other commands you recommend I can use to execute the python script from my WaveForms 2015 script? Best Regards, Nick
  25. Folks, I'm forced to use a win7 host for something (I've been a desktop linux-only for about 15 years). I'm working with an analog discovery 2 kit and wanted to develop using vi on cygwin which is quite lovely. Start with this post, after you install numpy, pip exits without errors but continuing install results in a lapack error something like this from numpy.linalg import lapack_lite, _umath_linalg you need to add /usr/lib/lapack to your PATH. export PATH=$PATH:/usr/lib/lapack you have to get numpy running correctly for matplotlib install to happen, plus a bunch of other cygwin installs as mentioned in posting. Yes, you cygwin setup install a bunch of stuff, including g++, c compiler, fortran stuff, gtk stuff, etc etc etc. Here's a cygcheck -c dump, see below, sorry so long. After all this, I ran the AD2 script and a plot showed up in x, yay - see attached!!! Oh wait, one more thing sys.platform.startswith returns 'cygwin', so you here's how you get dwf instantiated under cygwin python dwf = CDLL('dwf.dll') Good luck fellow lazy Linux programmers like me! Craig Cygwin Package Information Package Version Status _autorebase 001005-1 OK adwaita-icon-theme 3.22.0-1 OK adwaita-themes 3.22.3-1 OK alternatives 1.3.30c-10 OK base-cygwin 3.8-1 OK base-files 4.2-4 OK bash 4.4.12-3 OK binutils 2.25-4 OK bzip2 1.0.6-3 OK ca-certificates 2.14-1 OK compositeproto 0.4.2-1 OK coreutils 8.26-2 OK csih 0.9.9-1 OK cygrunsrv 1.62-1 OK cygutils 1.4.16-2 OK cygwin 2.8.1-1 OK cygwin-devel 2.8.1-1 OK damageproto 1.2.1-1 OK dash OK dbus 1.10.18-1 OK dbus-x11 1.10.18-1 OK dejavu-fonts 2.37-1 OK desktop-file-utils 0.23-1 OK diffutils 3.5-2 OK dri-drivers 17.1.3-1 OK editrights 1.03-1 OK file 5.30-1 OK findutils 4.6.0-1 OK fixesproto 5.0-1 OK gamin 0.1.10-15 OK gawk 4.1.4-3 OK gcc-core 5.4.0-1 OK gcc-fortran 5.4.0-1 OK gcc-g++ 5.4.0-1 OK gdk-pixbuf2.0-svg 2.40.17-1 OK getent 2.18.90-4 OK girepository-Atk1.0 2.22.0-1 OK girepository-cairo1.0 1.50.0-1 OK girepository-GdkPixbuf2.0 2.36.6-2 OK girepository-GLib2.0 1.50.0-1 OK girepository-HarfBuzz0.0 1.3.4-1 OK girepository-Pango1.0 1.40.6-1 OK girepository-x11 1.50.0-1 OK gnome-menus 3.13.3-3 OK grep 3.0-2 OK groff 1.22.3-1 OK gsettings-desktop-schemas 3.22.0-1 OK gtk-update-icon-cache 3.22.15-1 OK gtk2.0-engines-pixmap 2.24.31-1 OK gzip 1.8-1 OK hicolor-icon-theme 0.15-1 OK hostname 3.13-1 OK info 6.4-1 OK inputproto 2.3.1-1 OK ipc-utils 1.0-2 OK kbproto 1.0.7-1 OK less 487-1 OK libargp 20110921-3 OK libatk1.0-devel 2.22.0-1 OK libatk1.0_0 2.22.0-1 OK libatomic1 5.4.0-1 OK libattr1 2.4.46-1 OK libblkid1 2.25.2-2 OK libbz2-devel 1.0.6-3 OK libbz2_1 1.0.6-3 OK libcairo-devel 1.14.8-1 OK libcairo2 1.14.8-1 OK libcom_err2 1.42.12-2 OK libcroco0.6_3 0.6.12-1 OK libcrypt0 1.4-1 OK libdatrie1 0.2.8-1 OK libdb5.3 5.3.28-1 OK libdbus1_3 1.10.18-1 OK libedit0 20130712-1 OK libEGL-devel 17.1.3-1 OK libEGL1 17.1.3-1 OK libexpat-devel 2.2.1-0 OK libexpat1 2.2.1-0 OK libfam0 0.1.10-15 OK libffi-devel 3.2.1-2 OK libffi6 3.2.1-2 OK libfontconfig-common 2.12.1-1 OK libfontconfig-devel 2.12.1-1 OK libfontconfig1 2.12.1-1 OK libfontenc1 1.1.3-1 OK libfreetype-devel 2.6.5-1 OK libfreetype6 2.6.5-1 OK libgcc1 5.4.0-1 OK libgcrypt20 1.7.6-1 OK libgdbm4 1.12-1 OK libgdk_pixbuf2.0-devel 2.36.6-2 OK libgdk_pixbuf2.0_0 2.36.6-2 OK libgfortran3 5.4.0-1 OK libGL-devel 17.1.3-1 OK libGL1 17.1.3-1 OK libglade2.0_0 2.6.4-2 OK libglapi0 17.1.3-1 OK libglib2.0-devel 2.50.3-1 OK libglib2.0_0 2.50.3-1 OK libgmp10 6.1.2-1 OK libgnome-menu3_0 3.13.3-3 OK libgomp1 5.4.0-1 OK libgpg-error0 1.27-1 OK libgraphite2-devel 1.3.8-1 OK libgraphite2_3 1.3.8-1 OK libgssapi_krb5_2 1.14.4-1 OK libgtk2.0-devel 2.24.31-1 OK libgtk2.0_0 2.24.31-1 OK libharfbuzz-devel 1.3.4-1 OK libharfbuzz-gobject0 1.3.4-1 OK libharfbuzz0 1.3.4-1 OK libICE6 1.0.9-1 OK libiconv 1.14-3 OK libiconv2 1.14-3 OK libintl-devel OK libintl8 OK libisl13 0.14.1-1 OK libjasper1 1.900.22-1 OK libjasper4 2.0.12-1 OK libjbig2 2.0-14 OK libjpeg8 1.5.0-1 OK libk5crypto3 1.14.4-1 OK libkrb5_3 1.14.4-1 OK libkrb5support0 1.14.4-1 OK liblapack-devel 3.7.0-1 OK liblapack0 3.7.0-1 OK libllvm3.9 3.9.1-1 OK libllvm4.0 4.0.1-1 OK liblzma5 5.2.3-1 OK liblzo2_2 2.08-1 OK libmcpp0 2.7.2-2 OK libmpc3 1.0.3-1 OK libmpfr4 3.1.5-1p2 OK libncursesw10 6.0-11.20170617 OK libopenblas 0.2.19-1 OK libopenssl100 1.0.2k-1 OK libp11-kit0 0.23.5-1 OK libpango1.0-devel 1.40.6-1 OK libpango1.0_0 1.40.6-1 OK libpcre-devel 8.40-3 OK libpcre1 8.40-3 OK libpcre16_0 8.40-3 OK libpcre32_0 8.40-3 OK libpcrecpp0 8.40-3 OK libpcreposix0 8.40-3 OK libpipeline1 1.4.0-1 OK libpixman1-devel 0.34.0-1 OK libpixman1_0 0.34.0-1 OK libpng-devel 1.6.28-1 OK libpng-tools 1.6.28-1 OK libpng16 1.6.28-1 OK libpng16-devel 1.6.28-1 OK libpopt-common 1.16-2 OK libpopt0 1.16-2 OK libquadmath0 5.4.0-1 OK libreadline7 7.0.3-3 OK librsvg2_2 2.40.17-1 OK libsigsegv2 2.10-2 OK libSM6 1.2.2-1 OK libsmartcols1 2.25.2-2 OK libsqlite3_0 3.18.0-1 OK libssp0 5.4.0-1 OK libstdc++6 5.4.0-1 OK libtasn1_6 4.12-1 OK libthai0 0.1.26-1 OK libtiff6 4.0.7-1 OK libtxc_dxtn 1.0-1.20151227gitf6ec862 OK libuuid-devel 2.25.2-2 OK libuuid1 2.25.2-2 OK libvtv0 5.4.0-1 OK libX11-devel 1.6.5-1 OK libX11-xcb-devel 1.6.5-1 OK libX11-xcb1 1.6.5-1 OK libX11_6 1.6.5-1 OK libXau-devel 1.0.8-1 OK libXau6 1.0.8-1 OK libXaw7 1.0.13-1 OK libxcb-composite0 1.12-1 OK libxcb-devel 1.12-1 OK libxcb-ewmh2 0.4.1-1 OK libxcb-glx-devel 1.12-1 OK libxcb-glx0 1.12-1 OK libxcb-icccm4 0.4.1-1 OK libxcb-image0 0.3.9-1 OK libxcb-render-devel 1.12-1 OK libxcb-render0 1.12-1 OK libxcb-shm-devel 1.12-1 OK libxcb-shm0 1.12-1 OK libxcb-util1 0.3.9-1 OK libxcb1 1.12-1 OK libXcomposite-devel 0.4.3-1 OK libXcomposite1 0.4.3-1 OK libXcursor-devel 1.1.14-1 OK libXcursor1 1.1.14-1 OK libXdamage-devel 1.1.4-1 OK libXdamage1 1.1.4-1 OK libXdmcp-devel 1.1.2-1 OK libXdmcp6 1.1.2-1 OK libXext-devel 1.3.3-1 OK libXext6 1.3.3-1 OK libXfixes-devel 5.0.3-1 OK libXfixes3 5.0.3-1 OK libXfont1 1.5.2-1 OK libXfont2_2 2.0.1-1 OK libXft-devel 2.3.2-1 OK libXft2 2.3.2-1 OK libXi-devel 1.7.9-1 OK libXi6 1.7.9-1 OK libXinerama-devel 1.1.3-1 OK libXinerama1 1.1.3-1 OK libxkbfile1 1.0.9-1 OK libxml2 2.9.4-2 OK libXmu6 1.1.2-1 OK libXmuu1 1.1.2-1 OK libXpm4 3.5.12-1 OK libXrandr-devel 1.5.1-1 OK libXrandr2 1.5.1-1 OK libXrender-devel 0.9.9-1 OK libXrender1 0.9.9-1 OK libxslt 1.1.29-1 OK libXss-devel 1.2.2-1 OK libXss1 1.2.2-1 OK libXt6 1.1.5-1 OK login 1.11-1 OK luit 20130217-1 OK man-db 2.7.5-2 OK mcpp 2.7.2-2 OK mingw64-x86_64-binutils OK mingw64-x86_64-blas 3.7.0-1 OK mingw64-x86_64-gcc-core 5.4.0-3 OK mingw64-x86_64-gcc-fortran 5.4.0-3 OK mingw64-x86_64-headers 5.0.2-1 OK mingw64-x86_64-lapack 3.7.0-1 OK mingw64-x86_64-pkg-config 0.29.1-1 OK mingw64-x86_64-runtime 5.0.2-1 OK mingw64-x86_64-windows-default-manifest 6.4-1 OK mingw64-x86_64-winpthreads 5.0.2-1 OK mintty 2.7.8-0 OK ncurses 6.0-11.20170617 OK openssh 7.5p1-1 OK openssl 1.0.2k-1 OK p11-kit 0.23.5-1 OK p11-kit-trust 0.23.5-1 OK perl 5.22.3-1 OK perl_autorebase 5.22.3-1 OK perl_base 5.22.3-1 OK pkg-config 0.29.1-1 OK python 2.7.13-1 OK python-cairo 1.12.0-1 OK python-gobject 2.28.6-5 OK python-gobject-devel 2.28.6-5 OK python-gtk2.0 2.24.0-3 OK python-gtk2.0-devel 2.24.0-3 OK python-numpy 1.11.2-1 OK python-setuptools 34.3.2-1 OK python2 2.7.13-1 OK python2-appdirs 1.4.3-1 OK python2-asn1crypto 0.22.0-1 OK python2-backports.ssl_match_hostname OK python2-cairo 1.12.0-1 OK python2-cffi 1.9.1-1 OK python2-chardet 2.3.0-1 OK python2-cryptography 1.8.1-1 OK python2-devel 2.7.13-1 OK python2-enum34 1.1.6-1 OK python2-idna 2.5-1 OK python2-ipaddress 1.0.18-1 OK python2-lockfile 0.12.2-1 OK python2-lxml 3.7.3-1 OK python2-numpy 1.11.2-1 Incomplete python2-openssl 16.2.0-1 OK python2-packaging 16.8-1 OK python2-pip 9.0.1-1 OK python2-ply 3.9-1 OK python2-pycparser 2.17-1 OK python2-pyparsing 2.1.10-1 OK python2-requests 2.13.0-1 OK python2-setuptools 34.3.2-1 OK python2-six 1.10.0-1 OK python2-urllib3 1.20-1 OK python2-wheel 0.30.0a0-1 OK randrproto 1.5.0-1 OK rebase 4.4.2-1 OK renderproto 0.11.1-1 OK rsync 3.1.2-1 OK run 1.3.4-2 OK scrnsaverproto 1.2.2-2 OK sed 4.4-1 OK setxkbmap 1.3.1-1 OK shared-mime-info 1.7-1 OK tar 1.29-1 OK tcl 8.6.6-1 OK tcl-devel 8.6.6-1 OK tcl-tk 8.6.6-1 OK tcl-tk-devel 8.6.6-1 OK terminfo 6.0-11.20170617 OK tzcode 2016j-1 OK tzdata 2017b-1 OK util-linux 2.25.2-2 OK vim-minimal 8.0.0647-1 OK w32api-headers 5.0.2-1 OK w32api-runtime 5.0.2-1 OK which 2.20-2 OK windows-default-manifest 6.4-1 OK xauth 1.0.10-1 OK xcursor-themes 1.0.4-1 OK xdg-user-dirs 0.15-1 OK xextproto 7.3.0-1 OK xf86-video-dummy 0.3.8-1 OK xf86-video-nested 0.1.0-8.20160719git OK xineramaproto 1.2.1-1 OK xinit 1.3.4-12 OK xkbcomp 1.4.0-1 OK xkeyboard-config 2.21-1 OK xmodmap 1.0.9-1 OK xorg-server 1.19.2-1 OK xorg-server-common 1.19.2-1 OK xorg-x11-fonts-dpi75 7.5-3 OK xorg-x11-fonts-misc 7.5-3 OK xproto 7.0.31-1 OK xrdb 1.1.0-1 OK xterm 330-1 OK xwin-xdg-menu 20170321-1 OK xz 5.2.3-1 OK zlib-devel 1.2.11-1 OK zlib0 1.2.11-1 OK