telescope-term 0.2 → 0.5.1

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 +104 -36
  3. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe9acb76c22f417d5ad5f68dd8c5e34f00dbe06d2d1d3147d3c4c155718d8e20
4
- data.tar.gz: 1978de11b2f7d9ad85471ad025087db5ee4c7da050fc81fe8e42b5f9de4c6f74
3
+ metadata.gz: 4a3c05dde8a5ff611a62d0cfd72a5a811915d218b7af6cd977c14297396d8c31
4
+ data.tar.gz: f89a8414af71225d15d689d0cb1ea57b6669a0b67a43327e5e61e6c79754195d
5
5
  SHA512:
6
- metadata.gz: b8fee3b2e553e25e13f7917f7de3d1acfde610b02b1dc48edc80b5507f741cdba598e6fa208d78cdbe8704dcb6b2047c98ab28819f25e278323bd8af6ca0d88d
7
- data.tar.gz: e1391814eb3ff0c53b359c70cdf2a71ab56c6fadf23db979b356829557c31384aa729f471ae9d99de41a01056a174b48f04b4bd795e6d0e2ebbb9990cbf90a7d
6
+ metadata.gz: 17c083153fd29104fd907d5288247a6b5eb8b92db8eb8bc22692d725b89104c194ddc5aec27b7f515f411c5aec2f2560006151d131a229883d4baf3b0d42ea16
7
+ data.tar.gz: b268815b853c51df96d2d71fd1a4213cb52d4d14c06062ec212e6f06ebce7b47c77cec3f593c67dd5d3ffcba306914ef74e320c8017b5e9b71508ece97a2d1b2
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')
@@ -189,7 +184,7 @@ def main_getkey # GET KEY FROM USER
189
184
  when '?' # Show helptext in right window
190
185
  @w_ep.clr
191
186
  @w_ep.pa(249, 0, 0, @help)
192
- @w_ep.p("\n...Press any key to continue")
187
+ @w_ep.p("\n ...Press any key to continue")
193
188
  getch
194
189
  when 'TAB'
195
190
  if @tsmark
@@ -290,6 +285,19 @@ def main_getkey # GET KEY FROM USER
290
285
  elsif @epmark
291
286
  @epmark = @ep.length - 1
292
287
  end
288
+ when ' '
289
+ if @tsmark
290
+ @tstag.include?(@tsmark) ? @tstag.delete(@tsmark) : @tstag.push(@tsmark)
291
+ @tsmark += 1 unless @tsmark == @ts.length - 1
292
+ elsif @epmark
293
+ @eptag.include?(@epmark) ? @eptag.delete(@epmark) : @eptag.push(@epmark)
294
+ @epmark += 1 unless @epmark == @ep.length - 1
295
+ end
296
+ when 'u'
297
+ @tstag.clear
298
+ @eptag.clear
299
+ when 'o'
300
+ observe
293
301
  when 'b'
294
302
  File.write(Dir.home+'/.telescope.bu',"@ts = #{@ts}\n@ep = #{@ep}")
295
303
  when 'B'
@@ -306,6 +314,62 @@ def main_getkey # GET KEY FROM USER
306
314
  else
307
315
  end
308
316
  end
317
+ def observe
318
+ @tstag = @tstag.sort
319
+ @eptag = @eptag.sort
320
+ date = DateTime.now.strftime "%Y-%m-%d"
321
+ file = Dir.home + "/" + date + "_observation.txt"
322
+ obs = "Observation file: #{file}\n"
323
+ obs += "Observation date:\n\n"
324
+ obs += "This file lists the intended equipment for the observation date.\n"
325
+ obs += "Reference observations with telescope letter and eyepiece numbers (like A2, B1, etc.)\n\n"
326
+ obs += "─" * 100 + "\n"
327
+ enum = "ABCDE"
328
+ @tstag.each_with_index do |t, i|
329
+ d = @ts[t][1]
330
+ f = @ts[t][2]
331
+ obs += "Telescope (#{enum[i]}): " + @ts[t][0].ljust(15) + " ("
332
+ obs += d.to_s + "mm/" + f.to_s + "mm f/" + (f/d.to_f).truncate(1).to_s + ")"
333
+ mag = (5 * Math::log(d/10, 10) + 7.5).truncate(1).to_s
334
+ obs += " Max MAG: " + mag
335
+ sepd = (115.824/d).truncate(2).to_s
336
+ sepr = (3600*Math::asin(671E-6/d)*180/Math::PI).truncate(2).to_s
337
+ obs += " Min SEP: " + sepd + "/" + sepr + "\n"
338
+ end
339
+ obs += "No telescope(s) chosen for the observation\n" if @tstag.empty?
340
+ obs += "─" * 100 + "\n"
341
+ @eptag.each_with_index do |e, i|
342
+ m = @ep[e][1]
343
+ a = @ep[e][2]
344
+ obs += "Eyepiece (#{i+1}): " + @ep[e][0].ljust(15) + " ("
345
+ obs += m.to_s.rjust(4) + "mm/" + a.to_s.rjust(3) + "°) "
346
+ @tstag.each_with_index do |t, j|
347
+ d = @ts[t][1]
348
+ f = @ts[t][2]
349
+ obs += enum[j] + ": "
350
+ mag = (f.to_f/m)
351
+ obs += mag.truncate(1).to_s.rjust(5) + "x ("
352
+ fov = a/mag
353
+ deg = fov.to_i
354
+ mins = ((fov - fov.to_i) * 60)
355
+ min = mins.to_i
356
+ sec = ((mins - min) * 60).to_i
357
+ deg == 0 ? dgo = " " : dgo = deg.to_s + "°"
358
+ mno = min.to_s.rjust(2, " ") + "'"
359
+ sco = sec.to_s.rjust(2, " ") + "\""
360
+ obs += (dgo + mno + sco) + ") "
361
+ end
362
+ obs += "\n"
363
+ end
364
+ obs += "No eyepiece(s) chosen for the observation\n" if @eptag.empty?
365
+ obs += "─" * 100 + "\n\n"
366
+ obs += "Object: Equipment: Observation:\n" * 8
367
+ @w_ep.clr
368
+ @w_ep.pa(255, 0, 0, obs)
369
+ @w_ep.p("\n...Press any key to continue")
370
+ File.write(file, obs)
371
+ getch
372
+ end
309
373
 
310
374
  # TELESCOPE FUNCTIONS (top window, w_ts)
311
375
  def w_ts_show
@@ -322,10 +386,11 @@ def w_ts_show
322
386
  out = " " + name.ljust(15)
323
387
  out += d.to_s.rjust(8)
324
388
  out += f.to_s.rjust(8)
325
- @tsmark == i ? attr = Curses::A_BOLD | Curses::A_REVERSE : attr = Curses::A_BOLD
389
+ attr = Curses::A_BOLD
390
+ attr = attr | Curses::A_REVERSE if @tsmark == i
391
+ attr = attr | Curses::A_UNDERLINE if @tstag.include?(i)
326
392
  @w_ts.pa(254, 0, attr, out)
327
393
  out = (f.to_f/d.to_f).truncate(1).to_s.rjust(6)
328
- out = (f.to_f/d.to_f).truncate(1).to_s.rjust(6)
329
394
  @w_ts.pa(254, 0, 0, out)
330
395
  out = (5 * Math::log(d/10, 10) + 7.5).truncate(1).to_s.rjust(6)
331
396
  @w_ts.pa(229, 0, 0, out)
@@ -390,13 +455,16 @@ def w_ep_show
390
455
  out = " " + name.ljust(15)
391
456
  out += m.to_s.rjust(8)
392
457
  out += a.to_s.rjust(6) + "°"
393
- @epmark == i ? attr = Curses::A_BOLD | Curses::A_REVERSE : attr = Curses::A_BOLD
458
+ attr = Curses::A_BOLD
459
+ attr = attr | Curses::A_REVERSE if @epmark == i
460
+ attr = attr | Curses::A_UNDERLINE if @eptag.include?(i)
394
461
  @w_ep.pa(253, 0, attr, out)
395
462
  @ts.each do |scope|
396
463
  d = scope[1]
397
464
  f = scope[2]
398
465
  mag = (f.to_f/m)
399
- out = mag.truncate(1).to_s.rjust(8)
466
+ @w_ep.pa(254, 0, 0, " │")
467
+ out = mag.truncate(1).to_s.rjust(6)
400
468
  @w_ep.pa(156, 0, 0, out)
401
469
  fov = a/mag
402
470
  deg = fov.to_i
@@ -419,7 +487,7 @@ end
419
487
  # COMMAND FUNCTIONS (bottom window, w_cm)
420
488
  def w_cm_show
421
489
  @w_cm.fill
422
- @w_cm.p(" Telescope v0.2 - By Geir Isene (https://isene.com)")
490
+ @w_cm.p(" Telescope v0.2 - By Geir Isene (https://isene.com) - press '?' to display the help text")
423
491
  end
424
492
  def w_cm_getstr(pretext, text) # A SIMPLE READLINE-LIKE ROUTINE
425
493
  Curses.curs_set(1)
@@ -495,7 +563,7 @@ loop do # OUTER LOOP - (catching refreshes via 'r')
495
563
  maxy = Curses.lines
496
564
  # Curses::Window.new(h,w,y,x)
497
565
  @w_ts = Curses::Window.new(7, maxx - 2, 1, 1)
498
- @w_ep = Curses::Window.new(maxy - 10, maxx - 2, 9, 1)
566
+ @w_ep = Curses::Window.new(maxy - 10, maxx - 2, 8, 1)
499
567
  @w_cm = Curses::Window.new(1, maxx, maxy - 1, 0)
500
568
  @w_ts.fg, @w_ts.bg = 15, 0
501
569
  @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.2'
4
+ version: 0.5.1
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-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -30,9 +30,10 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.3.2
33
- description: With this program you can list your telescopes and eyepieces and get
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.
35
+ Easy interface. Run the program, then hit ''?'' to show the help file. New in v0.5.1:
36
+ Improved help text.'
36
37
  email: g@isene.com
37
38
  executables:
38
39
  - telescope