Python 3 Scientific Installation To-do List

Although I am a big fan of MATLAB, it’s time for me to really try out Python so I can fairly compare the pros and cons of both languages.

The first tiny hurdle for Python is its scattered installation process for Windows. I thought Python(x,y) will give me everything in one place, but turns out the Spyder is stuck in Python 2.7. To install Python 3.7, I’ll need to do it from scratch. Here are the steps:

  1. Download official Python 3. You will need that for the “pip” package manager located in {python37}/scripts
  2. Update PIP first to avoid complaints. You can run it anywhere in command prompt
    python -m pip install --upgrade pip
    You don’t call PIP to update PIP because you an executable cannot write itself in WindowsNote that for 32-bit Python, you might run into Python37\python.exe: No module named pip, so you might want to use ensurepip to bootstrap: python -m ensurepip
  3. Now I’ll need Spyder3, a MATLAB-like IDE. Qt5 is one of the pre-req:
    pip install PyQt5
  4. And finally Spyder3
    pip install Spyder
    pip does not install icons in your start menu. So I’ll need to manually create a shortcut
    {Python37}/Scripts/spyder3.exe
    .py files are not associated with Spyder3 (normally it’ll just directly run the python script with python3). I usually manually change the association in Windows to Sypder3.
  5. PyVISA is the analog of “Instrument Control Toolbox” in MATLAB.
    pip install pyvisa
    MATLAB’s Instrument Control Toobox also cover serial ports, which is done in Python by PySerial
    pip install PySerial
  6. Numpy is included with scipy:
    pip install scipy
  7. Turns out that only NumPy and IPython is installed with SciPy, not the entire ecosystem.
    pip install pandas
    pip install matplotlib
    If you know the power of dataset/table objects in MATLAB like I do, you’ll jump for dataframes in panadas.
  8. SymPy, the analog of MATLAB’s symoblic math toolbox, needs to be installed separately
    pip install sympy
  9. IPython gives the ‘notebook’ feel in Mathematica, MathCAD and Maple, where the returned results are directly pasted in the same area where your command/syntax is. I rarely cared for it because I usually want the max visual real estate for my plots.

Update: I tried Anaconda (2019.03, Python 3.7.3 x64) which supposedly have everything in one place, but the Spyder it included crashes right out of the box. Jyupter is confusing as it relies on the web-browser to render the results. Feels patchy and doesn’t look like it adds more than the steps above. Uninstalled it without hesitation.

Update: To update the packages, tack -U switch at the end of each of the above pip install commands. Remember to follow the order of dependencies (e.g. update PyQt5 before Spyder)

Loading

What is calibration? Hint: It is not adjustment!

Very often people doing R&D ask me if they need to have their oscilloscope calibrated. And for most of the time, my answer is no unless they need to have the NIST traceability or the calibration sticker to keep the regulatory bodies happy. They often thought it’s adjusting the calibration coefficients (or knobs) to make the unit more accurate. This is COMPLETELY WRONG.

In EEVBlog, they showed a video interview with Agilent Metrologist explaining what calibration actually does: it gives you the sample data points against trusted references about how your test instruments’ references has drifted between calibrations. Actually it’s preferable to not adjust the instruments if it’s already within specs.

 

Loading

TDS 500~800 series Monochrome CRT Driver Repair

The most common mode of CRT display failure in the TDS 500~800 series (Monochrome models) is the flyback transformer. The symptom is that after leaving the screen on for a couple of hours, the screen started stretching vertically until it disappears.

It also happens the failure only happens to a batch of CRT boards. The batch I’ve seen looks new (with modern markings that tells you the purpose of the trimpots) and lightly used, so I’m sure it’s infant mortality. Here’s the broken CRT driver board to be repaired:

There’s practically nowhere you can find this obsolete replacement because it’s not a common configuration. I sourced a batch from China that claimed the part number, and I spent whole day cursing the vendor when the flyback transformer arrived. Here’s what I saw:

The one on the right was the broken original flyback transformer, and two on the left were my new orders. Not only that the shapes are completely different, the number of pins doesn’t even match. WTF?!!!

The seller told me that it works. Forget about how to fit that in the board for a moment. How the f*** am I supposed to know which pins goes to which spot? Not to mention there are 11 dots when the original only has 8+1 (actually 7+1, pin#8 is not used). I said dots instead of pins because not all of them are populated with a pin, and the pins that are missing were not even consistent across the transformers in the batch.

I cannot even guess with a multimeter because it’s not a simple, uniform transformer. Even if I know which ones are connected, I could have ruined the whole thing by having the wrong number of coil turns/inductances because I switched a pair or two!

I had to push the seller really hard for him to dig up the actual mapping and draw me the pinouts on the pictures I’ve sent him (I’m sure the whole batch will be trash if I could not communicate with them in Chinese). The ‘product’ must have been designed and the manufacturing line ran by a bunch of village idiots. Nothing is right about it other than the windings inside are electrically usable (can’t even say compatible because I need to hack it really hard to get the correct display). Here’s the pinout:

Here’s another transformer that doesn’t have the ground pin (unnumbered), turns out the transformer works without it:

The space inside the oscilloscope case is pretty tight, and I managed to find one orientation that lines up with the case nicely, but it’s ugly as hell:

I held it down with hot-glue, caulk to stabilize it. A rubber band was put over it so that if the glue fails, the transformer won’t roll inside the compartment causing mayhem (later units I used cable ties since rubber band might deteriorate with heat. You get the idea.):

If you are not a hobbyist and don’t want the hassle of disassembling whole bunch of stuff just to take out the CRT driver, rebuild it with the said flyback transformer and re-tuning the CRT driver (not only it’s a huge pain, the working room is very tight if you don’t have the extension cables), I recommend sending the unit to me for a full CRT surgery (you pay for shipping costs both ways). I also charge a lot less if you combine it with other services such as re-capping (strengthening), NVRAM replacement, etc, in one trip.

Update (2023/07/02): the prices 6 years ago is no longer practical. Luckily nobody asked. This surgery is just way too much hassle to charge this little. If you have a big customer who really need to keep exactly the same model to avoid changing their process/certification/software, ask me for a spot quote. I usually give very generous combined discounts if there’s more than one thing to work on.

I don’t think anybody else have new compatible flyback transformers for these displays that has the same fate anymore. I’ll update this post when the ones I saved are used up.

Call me at 949-682-8145.

Loading