Scientific Computing

Ubuntu applications shortcuts

For Linux desktop environments programs show up in menus from:

  • /usr/share/applications
  • ~/.local/share/applications ← especially for WINE

Sometimes an application might not appear in the desktop menus because it doesn’t have a .desktop file in either of these locations. Try opening one of the .desktop files for a program that works, and saving as a new file, editing for a program you’d like to work the same way.

Reference

LaTeX content in parent/sibling directories

error: epstopdf Output filename not allowed in restricted mode

may occur if you include .eps files above the directory of the .tex file. LaTeX by default cannot traverse upwards from the current “*.tex” directory. This is generally a good security choice.

When necessary, it is possible to bypass this security by including the --shell-escape option in pdflatex command:

pdflatex --shell-escape myfile.tex

In TeXmaker / TeXstudio, under: Options → Configure → Commands add --shell-escape right after pdflatex in the PdfLaTeX command box.

This example shows when --shell-escape is needed. Assuming files

~/work/report.tex
~/matlab/plot.eps

This LaTeX content triggers the error until --shell-escape is used.

\includegraphics{../matlab/plot.eps}

Unstick Windows update network connection

Windows Fast Ring builds keep sticking at 87% before updating. I got into a giant boot loop where the update would fail or I’d hard reboot (hold power button) and this was not working. This problem can be fixed by if computer is on WiFi, additionally plug it in via Ethernet. This may require a USB 3 to Ethernet adapter if your PC doesn’t have an Ethernet port.

  1. Unplug the Ethernet connector when Windows Update is stuck (for me it was at 87%)
  2. wait say 10 seconds, then plug in Ethernet again.
  3. upon plugging Ethernet in, Windows Update very rapidly finished the update and rebooted and continued installing Windows.

This happened for me on multiple Windows builds. Each time, the procedure above made Windows Update complete rapidly and successfully.

TeXstudio user dictionary ignored words

The TeXstudio user dictionary is a plain-text .ign file. The user dictionary is used for simple match-and-ignore.

  • Linux: ~/.config/texstudio/texstudioen_US.ign
  • Windows: %APPDATA%/Roaming/TeXstudio/dictionaries/en_US.ign

Setup Red Pitaya for GNU Radio

Setup Red Pitaya:

Format a micro SD card to FAT32. Find the SD card device name from df – be sure you don’t overwrite your hard drive! Suppose the SD card is at /dev/mmcblk0:

umount /dev/mmcblk0
mkdosfs -F 32 -n GNURadio /dev/mmcblk0

Unzip Pavel Demins SD Card image to this SD card

mount /dev/mmcblk0 /mnt/GNURadio
unzip ecosystem-*-sdr-transceiver.zip -d /mnt/GNURadio
umount /mnt/GNURadio

Boot the Red Pitaya with this SD card. Connect to Red Pitaya via Ethernet using SSH (login/password root/root) using Avahi

ssh root@redpitaya.local

or via serial port


Setup laptop:

Setup GNU Radio Companion

cd ~
git clone https://github.com/pavel-demin/red-pitaya-notes

Create a shell script ~/rpgr to start GNU Radio Companion for Red Pitaya

#!/bin/sh
export GRC_BLOCKS_PATH=~/red-pitaya-notes/projects/sdr_transceiver/gnuradio

gnuradio-companion

Make it executable with

chmod +x ~/rpgr

Setup projects

Each directory where you have a GNU Radio Red Pitaya project must have a softlink to red_pitaya.py. In each of your GRC project code directories, do:

ln -s ~/red-pitaya-notes/projects/sdr_transceiver/gnuradio/red_pitaya.py .

This is because Red Pitaya is not yet an OOT (Out of Tree) module for GNU Radio.


Example GNU Radio code for Red Pitaya under RedPitaya/


Related: Red Pitaya Pulsed NMR image setup

Red Pitaya v1.1 educational pricing

The Red Pitaya v1.1 education pricing is currently 149 Euro or $166 US. A pair of Red Pitaya v1.1 will test the phase-modulated waveform for PiRadar.

This makes it easier to avoid fiddling around with the Raspberry Pi due to the PWM PLL timing glitches we observed in initial experiments. In fact, using the Red Pitaya for PiRadar will cost less than the Raspberry Pi!

RF Signal Generation and Reception:

  1. Transmit PiRadar waveform with 100 kHz bandwidth centered at 3.7 MHz: complex baseband → DUC → DAC
  2. Receive PiRadar waveform at 3.7 MHz with 100 kHz bandwidth: ADC → DDC → complex baseband
  3. Generate simple metric of data bandwidth vs. SNR and bandwidth in AWGN (should reasonably match theory)

Data recording: record complex baseband signal to USB HDD in digital_rf.

FPGA timing: has to work well or the rest of the radar doesn’t work – this is key project-wide blocker

  1. get 1 PPS to trigger noise sequence transmission.
  2. trigger receiver off of 1 PPS or mark receive samples with 1 PPS ticks

PiRadar Signal Processing:

  1. obtain previously recorded data
  2. what can we process onboard the Red Pitaya given limited CPU/RAM?
  3. first data reduction step: tagging obviously interesting data.
  4. Flag interesting data for long-term retention or priority over-the-air download or alerting.

Convert Latex Tikz diagram to SVG

LaTeX Tikz diagram can be converted to SVG vector graphics conversion at full quality from the command line (no GUI). Convert LaTeX Tikz diagram to SVG by generating PDF from LaTeX as usual:

pdflatex mydoc.tex

Use Inkscape from Terminal to convert PDF to SVG at full vector quality:

inkscape -l out.svg in.pdf

Convert SVG to EPS or PNG from command line

To use SVG in Overleaf or LaTeX without \usepackage{svg}, convert SVG to EPS or PNG. This may be needed for some journals that don’t allows using extra packages like svg.

Convert SVG to EPS: vector graphics conversion at full quality from the command line (no GUI). Imagemagick doesn’t seem to be able to do this, making a gigantic raster EPS. Inkscape does the vector SVG to EPS conversion well.

inkscape -E out.eps in.svg

Convert SVG to PNG (raster) with

inkscape -e out.png in.svg

See man inkscape for more options e.g. to select PNG resolution.