Skip to content

Commit cdfa1cc

Browse files
authoredMay 15, 2019
Initial upload of spectrum20 branch files
1 parent a4e0971 commit cdfa1cc

File tree

5 files changed

+88
-5
lines changed

5 files changed

+88
-5
lines changed
 

‎Makefile.in

+9-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ all: numbers spectrum
1414
# Make the spectrum chart
1515
spectrum: pictures
1616
$(LATEX) tex/spectrum.tex
17-
$(DVIPS) -Ppdf -T 24in,36in spectrum.dvi -f > spectrum.eps
17+
$(DVIPS) -Ppdf -T 21in,40in spectrum.dvi -f > spectrum.eps
1818
$(GS) -dSAFER -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=spectrum_current.pdf -dSAFER -c .setpdfwrite -f spectrum.eps
1919

2020
pictures:
@@ -48,8 +48,15 @@ numbers: numbers.c
4848
./numbers > tex/numbers.tex &
4949

5050
# Compile the utility to convert frequencies to positions on chart
51-
xpos: xpos.c
51+
xpos: xpos.c xpose6.c
5252
$(CC) -lm -o xpos xpos.c
53+
$(CC) -lm -o xpose6 xpose6.c
54+
55+
cell:
56+
cat tex/3G-F.txt | ./xpose6 1e6 0.000 0.020 > tex/3Gbands.tex
57+
cat tex/LTE-F.txt | ./xpose6 1e6 0.020 0.020 > tex/4Gbands.tex
58+
cat tex/5G-F1.txt | ./xpose6 1e6 0.040 0.020 > tex/5GF1bands.tex
59+
cat tex/5G-F2.txt | ./xpose6 1e9 0.040 0.020 > tex/5GF2bands.tex
5360

5461
# Compile the utility to convert a frequency range to positions on chart
5562
kuband:

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# spectrum
22
Electromagnetic Radiation Spectrum chart
33

4+
20x39" version
5+
46
http://unihedron.com/projects/spectrum/

‎configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ([2.69])
5-
AC_INIT([spectrum], [0.18], [BUG-REPORT-ADDRESS])
5+
AC_INIT([spectrum], [0.20], [BUG-REPORT-ADDRESS])
66
AC_CONFIG_SRCDIR([numbers.c])
77
AC_PATH_PROG([GS], [gs], [/usr/bin/gs])
88
AC_PATH_PROG([LATEX], [latex])

‎numbers.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ char *eng(double value, int places)
4040
places = (value >= 100.0) ? places-2 :
4141
(value >= 10.0) ? places-1 : places;
4242

43-
sprintf(res, "%.*f %s", places-1, value, prefixes[p]);
43+
sprintf(res, "%.*f}{ %s", places-1, value, prefixes[p]);
4444

4545
return result;
4646
}
4747

4848
void printlabel(double number, char * color, char * label)
4949
{
5050

51-
printf("\\uput{2pt}[270]( %2.1f,%2.1f){\\textcolor{%s}{%s%s}}\n" ,ColPosition ,RowPosition,color,eng(number,3),label);
51+
printf("\\uput{2pt}[270]( %2.1f,%2.1f){\\textcolor{%s}{\\SI{%s%s}}}\n" ,ColPosition ,RowPosition,color,eng(number,3),label);
5252

5353
ColPosition +=0.817; /* Increment_value = pspicture_width / 12 divisions*/
5454
}

‎xpose6.c

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#include<stdio.h>
2+
#include<stdlib.h>
3+
#include<math.h>
4+
/* Description: Generate X position for spectrum chart derived from xpos.c
5+
input: frequency range (default MHz)
6+
output: position row & col corrected inches
7+
Arguments: multiplier offset thickness
8+
9+
10+
Usage:
11+
cat tex/3G-F.txt | ./xpose6 1e6 0.250 0.020 > tex/3Gbands.tex
12+
cat tex/LTE-F.txt | ./xpose6 1e6 0.270 0.020 > tex/4Gbands.tex
13+
cat tex/5G-F1.txt | ./xpose6 1e6 0.290 0.020 > tex/5GF1bands.tex
14+
cat tex/5G-F2.txt | ./xpose6 1e9 0.290 0.020 > tex/5GF2bands.tex
15+
16+
*/
17+
18+
int main(int argc, char* argv[] ) {
19+
double multiplier;// multliper from command line
20+
double yoffset; //y offset from command line
21+
double thickness; //y thickness from command line
22+
double xpos, start, end, startxpos, endxpos, botypos, topypos, startposition,endposition,width;
23+
int startypos,endypos;
24+
width=9.8; /*inches*/
25+
26+
//Multiplier (i.e. 1e6, 1e9, etc).
27+
if( argc > 1 ) {
28+
multiplier = atof(argv[1]);
29+
} else {
30+
multiplier = 1.0;
31+
}
32+
33+
//Y offset in inches.
34+
if( argc > 2 ) {
35+
yoffset = atof(argv[2]);
36+
} else {
37+
yoffset = 0.0;
38+
}
39+
40+
//Y thickness in inches.
41+
if( argc > 3 ) {
42+
thickness = atof(argv[3]);
43+
} else {
44+
thickness = 0.100;
45+
}
46+
47+
while (scanf("%lf %lf", &start, &end) == 2){
48+
start = start * multiplier;
49+
end = end * multiplier;
50+
51+
/*bottom left corner of box */
52+
startposition = log(start)/log(2);
53+
startypos = (int)startposition;
54+
startxpos = ((startposition-(double)startypos))*width;
55+
botypos = (double)(startypos)/2+3.00+yoffset; //3.00 is the base
56+
57+
/*top right corner of box*/
58+
endposition = log(end)/log(2);
59+
endypos = (int)endposition;
60+
endxpos = ((endposition-(double)endypos))*width;
61+
topypos = (double)(endypos)/2+3.00+yoffset+thickness; //3.25 is the top
62+
63+
if (startxpos<endxpos){
64+
printf("\\psframe(%.3f,%.3f)(%.3f,%.3f)\n", startxpos, topypos-thickness, endxpos, topypos);
65+
}else{
66+
printf("\\psframe(%.3f,%.3f)(9.800,%.3f)", startxpos, botypos, botypos+thickness);
67+
printf("\\psframe(0.000,%.3f)(%.3f,%.3f)\n", topypos-thickness, endxpos, topypos);
68+
}
69+
70+
/* check for overlap */
71+
}
72+
return 0;
73+
74+
}

0 commit comments

Comments
 (0)