telescope-term 0.3 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/telescope +122 -52
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 787c1ac3f1065fa3ba4b3b6622cfe545a5701a8630ed9541cddd86b90fe3a609
4
- data.tar.gz: cee7a96f1efd1b494b78524ed788826f83f743362702da4fc87963077eee44d3
3
+ metadata.gz: 3ec5fe7e67a8718b893359293e5effc26ab0231dbb1140f9e7a3bcd27daaf595
4
+ data.tar.gz: 2843d0b8045b3a9792c8da5da2fcec973bf52a5157dd704ef7d42ac87ac2d057
5
5
  SHA512:
6
- metadata.gz: 3c0f9e82106903a9aefda701fcaace4673a906e0712fcd4919e1499ad00917f1d3ec34657513e79ed3ecf1bc91cb2d4d37af3e212b47146d8f23c778d320f3bc
7
- data.tar.gz: 72a190924d684c1856566756344633da3c7151ad6c6d38be3d2aee8e6e7390f054174d0f25b91f5dcc4fee966a4576940ae8e44881485b158f60ed6377c07be3
6
+ metadata.gz: d0b2674b2f1a89074cf8a07da2bf519bf9c3bec13b75b1162331b174dbf55386e4224d8167707a9d6febcebb61da7dd75e13eeeeda6eafc30b367d45619c20bd
7
+ data.tar.gz: 5cc9d3afc791fa9faa5e8c8aa27471404422dff3d5657ec99c1f030077ff49e184d08b075768caa6b1ca555bf520e3ee824a6b5233d006ef2841f5b9da81c8fd
data/bin/telescope CHANGED
@@ -1,42 +1,34 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
  @help = <<HELPTEXT
4
- Welcome to Telescope v0.2 - By Geir Isene (https://isene.com). This program is an aid for the amateur astronomer.
5
- It shows basic info about your telescopes and your eyepieces in combination with your telescopes.
6
- The top panel lists your telescopes with a set of properties. To add a telescope, press 't' and in the "command line"
7
- at the bottom enter a name, the apperature (APP) and the focal length (FL) of your telescope, then press ENTER.
8
- The lower panel lists your eyepieces with properties for each telescope. To add an eyepiece, press 'e'. Enter a name,
9
- the focal length (FL) and apparent field of view (AFOV) and press ENTER.
10
- You can select the telescope and eyepiece panel by pressing TAB, and each element of a panel by the UP and DOWN cursor keys.
11
- Upon selecting an item, press ENTER and change the values in the command line. Delete an item by pressing 'D'.
12
- Move an item up or down in a panel by pressing the PgUP or PgDown keys. Refresh all panels with the 'r' key.
13
- You can escape the selected panels or the command line by pressing 'Ctrl-G'. Quit via 'q' or 'Q' if you don't want to
14
- save your edits since last session. Telescope and eyepiece data is saved in the file '.telescope' in your home directory.
15
- Save a backup session with 'b' and load a previously saved backup session with the 'B' key.
4
+ WELCOME TO TELESCOPE - A TERMINAL/CONSOLE PROGRAM FOR THE AMATEUR ASTRONOMER.
5
+ The top panel lists your telescopes with eyepieces in the lower panel. Add a telescope by pressing 't' and fill in the name, the
6
+ apperature (APP) and the focal length (FL) in the "command line" at the bottom and press ENTER. Add an eyepiece with 'e' and enter
7
+ a name, the focal length (FL) and apparent field of view (AFOV) and press ENTER. Select items by pressing TAB, then UP/DOWN cursor keys.
8
+ Press ENTER on a selected item to change the values in the command line. Delete an item by pressing 'D'. Move an with PgUP/PgDown keys.
9
+ Tag items with the SPACE key (untag all with 'u'), then press 'o' to create an observation log file (content shown in the lower panel).
10
+ Refresh all panels with the 'r' key. Escape the selected panels or the command line by pressing 'Ctrl-G'. Quit via 'q' (or 'Q' if you
11
+ don't want to save your edits since last session). Save a backup session with 'b' and load a saved backup session with the 'B' key.
12
+ Telescope and eyepiece data is saved in the file '.telescope' in your home directory (backup file is '.telescope.bu').
16
13
 
17
- LIST OF TELESCOPE ABBREVIATIONS: LIST OF EYEPIECE ABBREVIATIONS:
18
- APP = Apperature (in millimeters) FL = Focal Length (in millimeters)
19
- FL = Focal Length (in millimeters) AFOV = Apparent Field Of View
20
- F/? = Focal ratio (FL/APP) xMAGN = Magnification (with that telescope)
21
- <MAG = Maximum magnitude visible FOV = True Field Of View (deg/min/sec)
22
- xEYE = Light gathering compared to the human eye XPUP = Exit pupil (in millimeters)
23
- MINx = Minimum usable magnification (may be lower for refractors)
24
- MAXx = Maximum usable magnification
25
- *FIELD = Recommended magnification for star fields
26
- GX/NEB = Recommended magnification for galaxies and nebulae
27
- PL/GCL = Recommended magnification for planets and globular clusters
28
- PLd/2* = Recommended magnification for planet details and double stars
29
- TGHT2* = Recommended magnification for tight double stars
30
- DL-SEP = Minimum separation, Dawes limit
31
- RC-SEP = Minimum separation, Rayleigh limit
32
- MOON = Minimum feature resolved on the Moon (in meters)
33
- SUN = Minimum feature resolved on the Sun (in kilometers)
14
+ LIST OF TELESCOPE ABBREVIATIONS: LIST OF EYEPIECE ABBREVIATIONS:
15
+ APP, FL, F/? = Apperature and Focal Length (millimeters) and F-ratio FL = Focal Length (in millimeters)
16
+ <MAG = Maximum magnitude visible AFOV = Apparent Field Of View
17
+ xEYE = Light gathering compared to the human eye xMAGN = Magnification (with that telescope)
18
+ MINx, MAXx = Minimum and maximum usable magnification FOV = True Field Of View (deg/min/sec)
19
+ XPUP = Exit pupil (in millimeters)
20
+ Recommended magnifications for objects:
21
+ *FIELD = star fields, GX/NEB = galaxies/nebulae, PL/GCL = planets/globular clusters
22
+ PLd/2* = planet details/double stars, TGHT2* = tight double stars
23
+ DL/RC-SEP = Minimum separation, Dawes limit and Rayleigh limit
24
+ MOON, SUN = Minimum feature resolved on the Moon (meters) & Sun (kilometers)
34
25
  HELPTEXT
35
26
  begin # BASIC SETUP
36
27
  if `tput cols`.to_i < 140
37
28
  puts "You must run Telescope with a minimum tarminal width of 140 chracters."
38
29
  end
39
30
  require 'io/console'
31
+ require 'date'
40
32
  require 'curses'
41
33
  include Curses
42
34
 
@@ -52,6 +44,9 @@ begin # BASIC SETUP
52
44
 
53
45
  @tsmark = false
54
46
  @epmark = false
47
+
48
+ @tstag = []
49
+ @eptag = []
55
50
  end
56
51
  if File.exist?(Dir.home+'/.telescope')
57
52
  load(Dir.home+'/.telescope')
@@ -60,6 +55,9 @@ class Numeric # NUMERIC CLASS EXTENSION
60
55
  def deg
61
56
  self * Math::PI / 180
62
57
  end
58
+ def dec2
59
+ "%.2f" % self
60
+ end
63
61
  end
64
62
  class Curses::Window # CLASS EXTENSION
65
63
  # General extensions (see https://github.com/isene/Ruby-Curses-Class-Extension)
@@ -189,7 +187,7 @@ def main_getkey # GET KEY FROM USER
189
187
  when '?' # Show helptext in right window
190
188
  @w_ep.clr
191
189
  @w_ep.pa(249, 0, 0, @help)
192
- @w_ep.p("\n...Press any key to continue")
190
+ @w_ep.p("\n ...Press any key to continue")
193
191
  getch
194
192
  when 'TAB'
195
193
  if @tsmark
@@ -290,6 +288,19 @@ def main_getkey # GET KEY FROM USER
290
288
  elsif @epmark
291
289
  @epmark = @ep.length - 1
292
290
  end
291
+ when ' '
292
+ if @tsmark
293
+ @tstag.include?(@tsmark) ? @tstag.delete(@tsmark) : @tstag.push(@tsmark)
294
+ @tsmark += 1 unless @tsmark == @ts.length - 1
295
+ elsif @epmark
296
+ @eptag.include?(@epmark) ? @eptag.delete(@epmark) : @eptag.push(@epmark)
297
+ @epmark += 1 unless @epmark == @ep.length - 1
298
+ end
299
+ when 'u'
300
+ @tstag.clear
301
+ @eptag.clear
302
+ when 'o'
303
+ observe
293
304
  when 'b'
294
305
  File.write(Dir.home+'/.telescope.bu',"@ts = #{@ts}\n@ep = #{@ep}")
295
306
  when 'B'
@@ -306,6 +317,62 @@ def main_getkey # GET KEY FROM USER
306
317
  else
307
318
  end
308
319
  end
320
+ def observe
321
+ @tstag = @tstag.sort
322
+ @eptag = @eptag.sort
323
+ date = DateTime.now.strftime "%Y-%m-%d"
324
+ file = Dir.home + "/" + date + "_observation.txt"
325
+ obs = "Observation file: #{file}\n"
326
+ obs += "Observation date:\n\n"
327
+ obs += "This file lists the intended equipment for the observation date.\n"
328
+ obs += "Reference observations with telescope letter and eyepiece numbers (like A2, B1, etc.)\n\n"
329
+ obs += "─" * 100 + "\n"
330
+ enum = "ABCDE"
331
+ @tstag.each_with_index do |t, i|
332
+ d = @ts[t][1]
333
+ f = @ts[t][2]
334
+ obs += "Telescope (#{enum[i]}): " + @ts[t][0].ljust(15) + " ("
335
+ obs += d.to_s + "mm/" + f.to_s + "mm f/" + (f/d.to_f).truncate(1).to_s + ")"
336
+ mag = (5 * Math::log(d/10, 10) + 7.5).truncate(1).to_s
337
+ obs += " Max MAG: " + mag
338
+ sepd = (115.824/d).truncate(2).to_s
339
+ sepr = (3600*Math::asin(671E-6/d)*180/Math::PI).truncate(2).to_s
340
+ obs += " Min SEP: " + sepd + "/" + sepr + "\n"
341
+ end
342
+ obs += "No telescope(s) chosen for the observation\n" if @tstag.empty?
343
+ obs += "─" * 100 + "\n"
344
+ @eptag.each_with_index do |e, i|
345
+ m = @ep[e][1]
346
+ a = @ep[e][2]
347
+ obs += "Eyepiece (#{i+1}): " + @ep[e][0].ljust(15) + " ("
348
+ obs += m.to_s.rjust(4) + "mm/" + a.to_s.rjust(3) + "°) "
349
+ @tstag.each_with_index do |t, j|
350
+ d = @ts[t][1]
351
+ f = @ts[t][2]
352
+ obs += enum[j] + ": "
353
+ mag = (f.to_f/m)
354
+ obs += mag.truncate(1).to_s.rjust(5) + "x ("
355
+ fov = a/mag
356
+ deg = fov.to_i
357
+ mins = ((fov - fov.to_i) * 60)
358
+ min = mins.to_i
359
+ sec = ((mins - min) * 60).to_i
360
+ deg == 0 ? dgo = " " : dgo = deg.to_s + "°"
361
+ mno = min.to_s.rjust(2, " ") + "'"
362
+ sco = sec.to_s.rjust(2, " ") + "\""
363
+ obs += (dgo + mno + sco) + ") "
364
+ end
365
+ obs += "\n"
366
+ end
367
+ obs += "No eyepiece(s) chosen for the observation\n" if @eptag.empty?
368
+ obs += "─" * 100 + "\n\n"
369
+ obs += "Object: Equipment: Observation:\n" * 8
370
+ @w_ep.clr
371
+ @w_ep.pa(255, 0, 0, obs)
372
+ @w_ep.p("\n...Press any key to continue")
373
+ File.write(file, obs)
374
+ getch
375
+ end
309
376
 
310
377
  # TELESCOPE FUNCTIONS (top window, w_ts)
311
378
  def w_ts_show
@@ -322,38 +389,39 @@ def w_ts_show
322
389
  out = " " + name.ljust(15)
323
390
  out += d.to_s.rjust(8)
324
391
  out += f.to_s.rjust(8)
325
- @tsmark == i ? attr = Curses::A_BOLD | Curses::A_REVERSE : attr = Curses::A_BOLD
326
- @w_ts.pa(254, 0, attr, out)
327
- out = (f.to_f/d.to_f).truncate(1).to_s.rjust(6)
392
+ attr = Curses::A_BOLD
393
+ attr = attr | Curses::A_REVERSE if @tsmark == i
394
+ attr = attr | Curses::A_UNDERLINE if @tstag.include?(i)
395
+ @w_ts.pa(254, 0, attr, out) # Basic info (Name, APP, FL)
328
396
  out = (f.to_f/d.to_f).truncate(1).to_s.rjust(6)
329
- @w_ts.pa(254, 0, 0, out)
397
+ @w_ts.pa(254, 0, 0, out) # F/?
330
398
  out = (5 * Math::log(d/10, 10) + 7.5).truncate(1).to_s.rjust(6)
331
- @w_ts.pa(229, 0, 0, out)
399
+ @w_ts.pa(229, 0, 0, out) # <MAG
332
400
  out = (d**2/49).to_i.to_s.rjust(6)
333
- @w_ts.pa(229, 0, 0, out)
401
+ @w_ts.pa(229, 0, 0, out) # xEYE
334
402
  out = magx(d, f, 1/7.to_f)
335
- @w_ts.pa(194, 0, 0, out)
403
+ @w_ts.pa(194, 0, 0, out) # MINx
336
404
  out = magx(d, f, 2)
337
- @w_ts.pa(194, 0, 0, out)
405
+ @w_ts.pa(194, 0, 0, out) # MAXx
338
406
  out = magx(d, f, 1/6.4)
339
- @w_ts.pa(189, 0, 0, out)
407
+ @w_ts.pa(189, 0, 0, out) # *FIELD
340
408
  out = magx(d, f, 1/3.6)
341
- @w_ts.pa(189, 0, 0, out)
409
+ @w_ts.pa(189, 0, 0, out) # GX/NEB
342
410
  out = magx(d, f, 1/2.1)
343
- @w_ts.pa(189, 0, 0, out)
411
+ @w_ts.pa(189, 0, 0, out) # PL/GCL
344
412
  out = magx(d, f, 1/1.3)
345
- @w_ts.pa(189, 0, 0, out)
413
+ @w_ts.pa(189, 0, 0, out) # PLd/2*
346
414
  out = magx(d, f, 1/0.7)
347
- @w_ts.pa(189, 0, 0, out)
348
- out = (115.824/d).truncate(2).to_s.rjust(7)
349
- @w_ts.pa(219, 0, 0, out)
350
- out = (3600*Math::asin(671E-6/d)*180/Math::PI).truncate(2).to_s.rjust(8)
351
- @w_ts.pa(219, 0, 0, out)
415
+ @w_ts.pa(189, 0, 0, out) # TGHT2*
416
+ out = (115.824/d).truncate(2).dec2.to_s.rjust(7)
417
+ @w_ts.pa(219, 0, 0, out) # DL-SEP
418
+ out = (3600*Math::asin(671E-6/d)*180/Math::PI).truncate(2).dec2.to_s.rjust(8)
419
+ @w_ts.pa(219, 0, 0, out) # RC-SEP
352
420
  moon = (384E6*Math::tan((Math::PI/180*115.824/d)/3600))
353
421
  out = moon.to_i.to_s.rjust(6) + "m"
354
- @w_ts.pa(225, 0, 0, out)
422
+ @w_ts.pa(225, 0, 0, out) # MOON
355
423
  out = (moon/2.5668).to_i.to_s.rjust(5) + "km"
356
- @w_ts.pa(225, 0, 0, out)
424
+ @w_ts.pa(225, 0, 0, out) # SUN
357
425
  @w_ts.p("\n")
358
426
  end
359
427
  @w_ts.clr_from_cur_line
@@ -390,7 +458,9 @@ def w_ep_show
390
458
  out = " " + name.ljust(15)
391
459
  out += m.to_s.rjust(8)
392
460
  out += a.to_s.rjust(6) + "°"
393
- @epmark == i ? attr = Curses::A_BOLD | Curses::A_REVERSE : attr = Curses::A_BOLD
461
+ attr = Curses::A_BOLD
462
+ attr = attr | Curses::A_REVERSE if @epmark == i
463
+ attr = attr | Curses::A_UNDERLINE if @eptag.include?(i)
394
464
  @w_ep.pa(253, 0, attr, out)
395
465
  @ts.each do |scope|
396
466
  d = scope[1]
@@ -420,7 +490,7 @@ end
420
490
  # COMMAND FUNCTIONS (bottom window, w_cm)
421
491
  def w_cm_show
422
492
  @w_cm.fill
423
- @w_cm.p(" Telescope v0.2 - By Geir Isene (https://isene.com)")
493
+ @w_cm.p(" Telescope v0.2 - By Geir Isene (https://isene.com) - press '?' to display the help text")
424
494
  end
425
495
  def w_cm_getstr(pretext, text) # A SIMPLE READLINE-LIKE ROUTINE
426
496
  Curses.curs_set(1)
@@ -496,7 +566,7 @@ loop do # OUTER LOOP - (catching refreshes via 'r')
496
566
  maxy = Curses.lines
497
567
  # Curses::Window.new(h,w,y,x)
498
568
  @w_ts = Curses::Window.new(7, maxx - 2, 1, 1)
499
- @w_ep = Curses::Window.new(maxy - 10, maxx - 2, 9, 1)
569
+ @w_ep = Curses::Window.new(maxy - 10, maxx - 2, 8, 1)
500
570
  @w_cm = Curses::Window.new(1, maxx, maxy - 1, 0)
501
571
  @w_ts.fg, @w_ts.bg = 15, 0
502
572
  @w_ep.fg, @w_ep.bg = 255, 232
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telescope-term
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-08 00:00:00.000000000 Z
11
+ date: 2021-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -32,8 +32,8 @@ dependencies:
32
32
  version: 1.3.2
33
33
  description: 'With this program you can list your telescopes and eyepieces and get
34
34
  a set of calculations done for each scope and for the combination of scope and eyepiece.
35
- Easy interface. Run the program, then hit ''?'' to show the help file. New in v0.2:
36
- UI upgrade.'
35
+ Easy interface. Run the program, then hit ''?'' to show the help file. New in v0.5.2:
36
+ Minor fixes.'
37
37
  email: g@isene.com
38
38
  executables:
39
39
  - telescope