Cohen-Sutherland line clipping in Python
Pure Python lineClipping.py for Cohen-Sutherland line clipping code.
Pure Python lineClipping.py for Cohen-Sutherland line clipping code.
These commands assume the username you want to manipulate is joe.
Note that adding sudo privileges gives them full control over the PC to install anything including rootkits and malware.
adduser joe sudodeluser joe sudogetent group sudoIf the option to upgrade the Ubuntu version doesn’t show up, try force-upgrade Ubuntu version with
do-release-upgrade -dThe choices for high power license free operation (such as for harmonic radar transmitters) are typically between the 915MHz, 2.4 GHz or 5.8 GHz bands. Other bands are available in specific countries, for example 868 MHz is often available where 915 MHz is not available. I do not say that you can blast across the whole band without a careful legal review of the regulations, but this page is perhaps a better place to start a marketable product than buying a 10 kW Furino marine radar at 9.3 GHz, where it’s only license-free aboard a seagoing vessel. High power makes harmonic radar easier, and university research exemptions have led to lots of papers using marine radars, but realize such marine radar based systems may struggle mightily to legally come to market. There have been enforcement actions against those using marine radars for “good” purposes, even far from any body of water.
| Band (MHz) | EIRP (Watts) USA |
|---|---|
| 902 - 928 | 4 |
| 2400 - 2483.5 | 4 |
| 5725 - 5875 | 4 |
The passive radar tags will create a useful emission at the second harmonic of the radar frequency.
Free space loss, the major limiting factor in maximum standoff distance between tag and radar, increases ~ f2 ~ (1/lambda)2
We obtain this fact by inspection of the Friis free space loss equation:
path loss dB = 20 log10((4 π d f)/c)
Therefore, all else being equal (antenna gains, power, etc.) if 915 MHz is used as the radar transmit frequency instead of 5.8 GHz, we expect
20log10(5800/915) + 20log10(11600/1830)= 32
dB less loss on the two-way path. So assuming I can use bigger antennas (radar and tags) on 915MHz to keep the same gain as on 5.8 GHz, I can use a 1 Watt radar at 915 MHz as effectively as a 1600 Watt radar at 5.8 GHz, with regard to maximum range. This may seem fantastic, but one would probably select an antenna for 5.8 GHz with more gain than at 915MHz, making the EIRP higher without a gigantic transmitter.
This is a strictly back-of-envelope approach, there are numerous factors to consider before selecting a frequency range for you application–contact us to discuss further.
We generally think only about the radar transmitter EIRP for unbiased tags, as the typical license-free emission limit (in the United States) of 500 uV/m @ 3 m = -41.3 dBm is easily met by the harmonic radar tag, since unbiased tags have 20-30 dB loss. Additionally, for the United States, the FCC has determined that such tags (like RFID) are passive devices and the certification is on the radar. For the case of biased tags, the battery is separate from the RF (there is no RF interaction due to the battery, the battery just reduces losses of the diode) and a similar FCC argument holds.
Here is an incomplete listing of countries–note this doesn’t mean you can blast your radar across the whole band necessarily, you will need to examine the particulars for each country.
| Country | Frequency [MHz] | EIRP [Watts] |
|---|---|---|
| USA | 902 - 928 | 4 |
| Canada | 902 - 928 | 4 |
| Mexico | 902 - 928 | 4 |
| Japan | 916.7 - 923.5 | 0.5 (4W licensed) |
| China | 920.5 - 924.5 | 2 |
| Hong Kong | 920 - 925 | 4 |
| South Korea | 917 - 920.8 | 4 |
| Australia | 920 - 926 | 4 |
| New Zealand | 915 - 925 | |
| United Kingdom | 915 - 921 | 4 |
| South Africa | 915.1 - 921 | 4 |
and very many more not listed here.
With only 3 to 26 MHz bandwidth depending on the country, by
Δ R > c/(2B)
we expect 40 to 6 meters range resolution. Depending on the application, one can make a workable system from that.
Since it takes a very strong signal, typically -30 dBm or more from the radar into the tag to generate a useful return, we don’t usually find interference on the radar transmit frequency to be a large concern. On the radar receive frequency, at the second harmonic of the transmit frequency, interference could be a concern for unmodulated radars using the 915/1830 MHz pair, since 1830 MHz is in LTE band 3. One can select a radar modulation scheme such that uncorrelated transmissions such as LTE have a minimal impact. For other frequency pairings, consider the types of RF environments your end users will be in. Is is a large dock with high power X-band radars on the container ships? Is it in the vicinity of fixed microwave or satellite links?
Many times, we select what is convenient at hand for preliminary experiments, or follow on what a previous paper used. It can be easier to prototype at lower frequencies and longer range can be achieved, but ensure your application can support the required tag antenna size. Consider the regulations and interference environments of your target markets. Don’t expect more than 10’s of meters range with unbiased diode tags, unless you have some specific experiments or other evidence supporting.
Reinstalling VirtualBox may fix issues with a missing kernel driver wanting to install dkms and run “/sbin/vboxconfig”. This error usually happens when going between VirtualBox major or point releases. It can also happen when upgrading the Linux operating system.
Uninstall old Virtualbox by
apt remove virtualboxor
dpkg -r virtualboxThen reinstall new Virtualbox:
gdebi virtualbox*.debSVXlink can be used as a Linux Echolink SERVER (repeater, link). Qtel is a Linux Echolink client. Echolink for Windows program also works very well from WINE.
apt install svxlink-server qtelCreate “~/.svxlink/svxlink.conf” containing
[SimplexLogic]
CALLSIGN= #your callsign e.g. W1AW
[RepeaterLogic]
CALLSIGN= #your callsign e.g. W1AWModify “/etc/svxlink/svxlink.d/ModuleEcholink.conf”
CALLSIGN= #your Echolink system callsign e.g. W1AW-L or W1AW-R need the appropriate suffix
PASSWORD= # your Echolink system passwordRestart the server and try to connect from Qtel or other Echolink client.
Remote upgrading an operating system over SSH is a little risky, so it should only be considered when you accept the full risk of having to go physically to the PC and reinstall everything, possibly losing the files. You will need an open firewall for the backup temporary SSH server enabled by the Ubuntu upgrade (port 1022?); perhaps open all ports temporarily to the IP address of your local laptop from the remote PC.
The commands to be run on the remote PC are
screen
do-release-upgrade -dSometimes an Ubuntu in-place upgrade will error, failing to install packages like:
systemd-sysv
init
gvfs
At the end of the install, the Ubuntu upgrade installer said the install had failed, and it was going to revert with dpkg --configure -a.
That will typically also fail.
As a last resort, consider a recovery procedure as below.
This will keep the new Ubuntu version if it works.
Open a second Terminal, WITHOUT clicking close on that dialog:
apt install gvfs init systemd-sysvIn the same new Terminal:
rebootAs a radio scientist, I need software defined radio (SDR) transmitters that ingest raw IQ (in-phase, quadrature) data. IQ data allows transmitting anything within the instantaneous bandwidth and dynamic range limitations of the particular SDR.
The rpitx program by F5OEO ingests IQ data (and has utilities to convert from audio to popular analog formats such as SSB, AM, and FM voice) to transmit on air from the Raspberry Pi onboard PLL via PWM accessed on the GPIO 12 pin using DMA.
The Raspberry Pi BCM2835 PLL PLLD operates at 500 MHz,
decimated down to the carrier frequency desired and modulated, with claimed resolution ~16 bit.
Install rpitx at Raspberry Pi Terminal:
apt install git
git clone https://github.com/F5OEO/rpitx
cd rpitx
./install.shRun rpitx IQ transmitter:
rpitx -i myfile.bin -m iq -f 97500This command transmits single-precision complex64 IQ file myfile.bin at 97.5 MHz center frequency (consider the error in the Raspberry Pi PLL baseclock).
F5OEO notes live video streaming 64 k-symbol/sec - 4 M-symbol/sec DVS-B using rpidatv, which sends DVS-B HD video receivable by the $20 RTL-SDR dongles.
With the Raspberry Pi 2 collecting samples at 2.048 MS/s, about 3% of one CPU core is used.
This does not include demodulation, just passing samples.
After installing rtl-sdr, you can playback over the Raspberry Pi headphone jack using aplay.
99.5 FM broadcast, in stereo on the Raspberry Pi:
rtl_fm -f 99.5M -M wbfm | aplay -r 24k -f S16_LE -t raw -c 1162.475 MHz NOAA weather radio (NBFM)
rtl_fm -f 162.475M -M fm -s 64k -Afast -r 32k -E demp | aplay -r 24k -f S16_LE -t raw -c 1CPU Utilization in percent:
| Rpi Model | Stream 2.048 MS/s, no demod | WBFM playback over headphone jack |
|---|---|---|
| 2 | 3.0 | 12.0 |
Complex*16 double precision
A subtle yet critical problem using double precision complex numbers can arise between Fortran and Python using f2py. f2py doesn’t seem to understand the kind parameters we specify when assigning a variable. f2py assumes your complex numbers are single precision (8 bytes per complex number) instead of double precision (16 bytes per complex number).
You won’t get an error on compiling, but your Python program importing the Fortran .so module will give erroneous results.
Assuming the program has
use, intrinsic :: iso_c_binding, only: sp=>C_FLOAT, dp=>C_DOUBLEAssign a double-precision complex variable like
complex(dp) :: xCopy file
.f2py_f2cmap
into the top directory of your Python project (where setup.py is), containing:
dict(real= dict(sp='float', dp='double'),
complex = dict(sp='complex_float',dp="complex_double"))At this time it appears we don’t use the C_DOUBLE_COMPLEX from iso_c_binding,
I notice that F90Wrap does the same.