telescope-term 0.3 → 0.4

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 +112 -34
  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: 1ea6b3e73010cffa6a0324e98ab9ef000ddf7c28f175f35d4596d0918d4c5bb5
4
+ data.tar.gz: 0e8673add4c94a37ea777955c332cc78d2a5abf12f417910b827fbebd55f59b3
5
5
  SHA512:
6
- metadata.gz: 3c0f9e82106903a9aefda701fcaace4673a906e0712fcd4919e1499ad00917f1d3ec34657513e79ed3ecf1bc91cb2d4d37af3e212b47146d8f23c778d320f3bc
7
- data.tar.gz: 72a190924d684c1856566756344633da3c7151ad6c6d38be3d2aee8e6e7390f054174d0f25b91f5dcc4fee966a4576940ae8e44881485b158f60ed6377c07be3
6
+ metadata.gz: 07ba9d284c86a7780af29ce2af1b12e6c8fa3e43ffc48b4e3743a72d235da4aefd83e1d2260f6a2a0e41aeb0d337a5224149026809571eb3d655a403e2b80530
7
+ data.tar.gz: d82e0a4e639b6052b6d2b7aea24146d93964f6f4e889f3c19c3cfa131e1c8a60c4a1f350362007f637bb7e4ad210cfe2cfccc4994c71d8837a8e8f9ec33519b6
data/bin/telescope CHANGED
@@ -1,42 +1,45 @@
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. To add a telescope, press 't' and in the "command line"
6
+ at the bottom enter a name, the apperature (APP) and the focal length (FL) and press ENTER.
7
+ The lower panel lists your eyepieces with properties for each telescope. To add an eyepiece, press 'e'.
8
+ Enter a name, the focal length (FL) and apparent field of view (AFOV) and press ENTER.
9
+ Select the telescope and eyepiece panel by pressing TAB, and use the UP, DOWN, HOME and END cursor keys.
10
+ Press ENTER on a selected item to change the values in the command line. Delete an item by pressing 'D'.
11
+ Move an item up or down in a panel by pressing the PgUP or PgDown keys.
12
+ Tag items for use in an observation using the SPACE key (untag all with 'u'). Press 'o' to create an observation
13
+ log file with the tagged equipment. The content of the file is then shown in the lower panel.
14
+ Refresh all panels with the 'r' key. Escape the selected panels or the command line by pressing 'Ctrl-G'.
15
+ Quit via 'q' (or 'Q' if you don't want to save your edits since last session).
16
+ Save a backup session with 'b' and load a previously saved backup session with the 'B' key.
17
+ Telescope and eyepiece data is saved in the file '.telescope' in your home directory.
16
18
 
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)
19
+ LIST OF TELESCOPE ABBREVIATIONS: LIST OF EYEPIECE ABBREVIATIONS:
20
+ APP = Apperature (in millimeters) FL = Focal Length (in millimeters)
21
+ FL = Focal Length (in millimeters) AFOV = Apparent Field Of View
22
+ F/? = Focal ratio (FL/APP) xMAGN = Magnification (with that telescope)
23
+ <MAG = Maximum magnitude visible FOV = True Field Of View (deg/min/sec)
24
+ xEYE = Light gathering compared to the human eye XPUP = Exit pupil (in millimeters)
25
+ MINx = Minimum usable magnification (may be lower for refractors)
26
+ MAXx = Maximum usable magnification
27
+ *FIELD = Recommended magnification for star fields
28
+ GX/NEB = Recommended magnification for galaxies and nebulae
29
+ PL/GCL = Recommended magnification for planets and globular clusters
30
+ PLd/2* = Recommended magnification for planet details and double stars
31
+ TGHT2* = Recommended magnification for tight double stars
32
+ DL-SEP = Minimum separation, Dawes limit
33
+ RC-SEP = Minimum separation, Rayleigh limit
34
+ MOON = Minimum feature resolved on the Moon (in meters)
35
+ SUN = Minimum feature resolved on the Sun (in kilometers)
34
36
  HELPTEXT
35
37
  begin # BASIC SETUP
36
38
  if `tput cols`.to_i < 140
37
39
  puts "You must run Telescope with a minimum tarminal width of 140 chracters."
38
40
  end
39
41
  require 'io/console'
42
+ require 'date'
40
43
  require 'curses'
41
44
  include Curses
42
45
 
@@ -52,6 +55,9 @@ begin # BASIC SETUP
52
55
 
53
56
  @tsmark = false
54
57
  @epmark = false
58
+
59
+ @tstag = []
60
+ @eptag = []
55
61
  end
56
62
  if File.exist?(Dir.home+'/.telescope')
57
63
  load(Dir.home+'/.telescope')
@@ -189,7 +195,7 @@ def main_getkey # GET KEY FROM USER
189
195
  when '?' # Show helptext in right window
190
196
  @w_ep.clr
191
197
  @w_ep.pa(249, 0, 0, @help)
192
- @w_ep.p("\n...Press any key to continue")
198
+ @w_ep.p("\n ...Press any key to continue")
193
199
  getch
194
200
  when 'TAB'
195
201
  if @tsmark
@@ -290,6 +296,19 @@ def main_getkey # GET KEY FROM USER
290
296
  elsif @epmark
291
297
  @epmark = @ep.length - 1
292
298
  end
299
+ when ' '
300
+ if @tsmark
301
+ @tstag.include?(@tsmark) ? @tstag.delete(@tsmark) : @tstag.push(@tsmark)
302
+ @tsmark += 1 unless @tsmark == @ts.length - 1
303
+ elsif @epmark
304
+ @eptag.include?(@epmark) ? @eptag.delete(@epmark) : @eptag.push(@epmark)
305
+ @epmark += 1 unless @epmark == @ep.length - 1
306
+ end
307
+ when 'u'
308
+ @tstag.clear
309
+ @eptag.clear
310
+ when 'o'
311
+ observe
293
312
  when 'b'
294
313
  File.write(Dir.home+'/.telescope.bu',"@ts = #{@ts}\n@ep = #{@ep}")
295
314
  when 'B'
@@ -306,6 +325,62 @@ def main_getkey # GET KEY FROM USER
306
325
  else
307
326
  end
308
327
  end
328
+ def observe
329
+ @tstag = @tstag.sort
330
+ @eptag = @eptag.sort
331
+ date = DateTime.now.strftime "%Y-%m-%d"
332
+ file = Dir.home + "/" + date + "_observation.txt"
333
+ obs = "Observation file: #{file}\n"
334
+ obs += "Observation date:\n\n"
335
+ obs += "This file lists the intended equipment for the observation date.\n"
336
+ obs += "Reference observations with telescope letter and eyepiece numbers (like A2, B1, etc.)\n\n"
337
+ obs += "─" * 100 + "\n"
338
+ enum = "ABCDE"
339
+ @tstag.each_with_index do |t, i|
340
+ d = @ts[t][1]
341
+ f = @ts[t][2]
342
+ obs += "Telescope (#{enum[i]}): " + @ts[t][0].ljust(15) + " ("
343
+ obs += d.to_s + "mm/" + f.to_s + "mm f/" + (f/d.to_f).truncate(1).to_s + ")"
344
+ mag = (5 * Math::log(d/10, 10) + 7.5).truncate(1).to_s
345
+ obs += " Max MAG: " + mag
346
+ sepd = (115.824/d).truncate(2).to_s
347
+ sepr = (3600*Math::asin(671E-6/d)*180/Math::PI).truncate(2).to_s
348
+ obs += " Min SEP: " + sepd + "/" + sepr + "\n"
349
+ end
350
+ obs += "No telescope(s) chosen for the observation\n" if @tstag.empty?
351
+ obs += "─" * 100 + "\n"
352
+ @eptag.each_with_index do |e, i|
353
+ m = @ep[e][1]
354
+ a = @ep[e][2]
355
+ obs += "Eyepiece (#{i+1}): " + @ep[e][0].ljust(15) + " ("
356
+ obs += m.to_s.rjust(4) + "mm/" + a.to_s.rjust(3) + "°) "
357
+ @tstag.each_with_index do |t, j|
358
+ d = @ts[t][1]
359
+ f = @ts[t][2]
360
+ obs += enum[j] + ": "
361
+ mag = (f.to_f/m)
362
+ obs += mag.truncate(1).to_s.rjust(5) + "x ("
363
+ fov = a/mag
364
+ deg = fov.to_i
365
+ mins = ((fov - fov.to_i) * 60)
366
+ min = mins.to_i
367
+ sec = ((mins - min) * 60).to_i
368
+ deg == 0 ? dgo = " " : dgo = deg.to_s + "°"
369
+ mno = min.to_s.rjust(2, " ") + "'"
370
+ sco = sec.to_s.rjust(2, " ") + "\""
371
+ obs += (dgo + mno + sco) + ") "
372
+ end
373
+ obs += "\n"
374
+ end
375
+ obs += "No eyepiece(s) chosen for the observation\n" if @eptag.empty?
376
+ obs += "─" * 100 + "\n\n"
377
+ obs += "Object: Equipment: Observation:\n" * 8
378
+ @w_ep.clr
379
+ @w_ep.pa(255, 0, 0, obs)
380
+ @w_ep.p("\n...Press any key to continue")
381
+ File.write(file, obs)
382
+ getch
383
+ end
309
384
 
310
385
  # TELESCOPE FUNCTIONS (top window, w_ts)
311
386
  def w_ts_show
@@ -322,10 +397,11 @@ def w_ts_show
322
397
  out = " " + name.ljust(15)
323
398
  out += d.to_s.rjust(8)
324
399
  out += f.to_s.rjust(8)
325
- @tsmark == i ? attr = Curses::A_BOLD | Curses::A_REVERSE : attr = Curses::A_BOLD
400
+ attr = Curses::A_BOLD
401
+ attr = attr | Curses::A_REVERSE if @tsmark == i
402
+ attr = attr | Curses::A_UNDERLINE if @tstag.include?(i)
326
403
  @w_ts.pa(254, 0, attr, out)
327
404
  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
405
  @w_ts.pa(254, 0, 0, out)
330
406
  out = (5 * Math::log(d/10, 10) + 7.5).truncate(1).to_s.rjust(6)
331
407
  @w_ts.pa(229, 0, 0, out)
@@ -390,7 +466,9 @@ def w_ep_show
390
466
  out = " " + name.ljust(15)
391
467
  out += m.to_s.rjust(8)
392
468
  out += a.to_s.rjust(6) + "°"
393
- @epmark == i ? attr = Curses::A_BOLD | Curses::A_REVERSE : attr = Curses::A_BOLD
469
+ attr = Curses::A_BOLD
470
+ attr = attr | Curses::A_REVERSE if @epmark == i
471
+ attr = attr | Curses::A_UNDERLINE if @eptag.include?(i)
394
472
  @w_ep.pa(253, 0, attr, out)
395
473
  @ts.each do |scope|
396
474
  d = scope[1]
@@ -496,7 +574,7 @@ loop do # OUTER LOOP - (catching refreshes via 'r')
496
574
  maxy = Curses.lines
497
575
  # Curses::Window.new(h,w,y,x)
498
576
  @w_ts = Curses::Window.new(7, maxx - 2, 1, 1)
499
- @w_ep = Curses::Window.new(maxy - 10, maxx - 2, 9, 1)
577
+ @w_ep = Curses::Window.new(maxy - 10, maxx - 2, 8, 1)
500
578
  @w_cm = Curses::Window.new(1, maxx, maxy - 1, 0)
501
579
  @w_ts.fg, @w_ts.bg = 15, 0
502
580
  @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.4'
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
@@ -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.4:
36
+ Added observation log capabilities.'
37
37
  email: g@isene.com
38
38
  executables:
39
39
  - telescope