|
| 1 | +#!/usr/bin/perl |
| 2 | + |
| 3 | +# |
| 4 | +# Tool for create a GCVS catalog for Stellarium |
| 5 | +# |
| 6 | +# Copyright (C) 2013, 2019 Alexander Wolf |
| 7 | +# |
| 8 | +# Permission is hereby granted, free of charge, to any person obtaining a |
| 9 | +# copy of this software and associated documentation files (the "Software"), |
| 10 | +# to deal in the Software without restriction, including without limitation |
| 11 | +# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 12 | +# and/or sell copies of the Software, and to permit persons to whom the |
| 13 | +# Software is furnished to do so, subject to the following conditions: |
| 14 | +# |
| 15 | +# The above copyright notice and this permission notice shall be included |
| 16 | +# in all copies or substantial portions of the Software. |
| 17 | +# |
| 18 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 24 | +# SOFTWARE. |
| 25 | +# |
| 26 | + |
| 27 | +$SC = "./vcat-hip.dat"; # Source |
| 28 | +$OC = "./gcvs_hip_part.dat"; # Destination |
| 29 | + |
| 30 | +open (OC, ">$OC"); |
| 31 | +open (SC, "$SC"); |
| 32 | +while (<SC>) { |
| 33 | + $rawstring = $_; |
| 34 | + $hipstr = substr($rawstring,0,6); |
| 35 | + $designationstr = substr($rawstring,15,9); |
| 36 | + $vclassstr = substr($rawstring,48,9); |
| 37 | + $maxmagstr = substr($rawstring,59,7); |
| 38 | + $ampflagstr = substr($rawstring,69,1); |
| 39 | + $min1magstr = substr($rawstring,70,6); |
| 40 | + $min2magstr = substr($rawstring,83,6); |
| 41 | + $flagstr = substr($rawstring,95,2); |
| 42 | + $epochstr = substr($rawstring,98,10); |
| 43 | + $periodstr = substr($rawstring,118,16); |
| 44 | + $mmstr = substr($rawstring,138,2); |
| 45 | + $sclassstr = substr($rawstring,144,16); |
| 46 | + |
| 47 | + $hipstr =~ s/(\s+)//gi; |
| 48 | + $designationstr =~ s/(\s+)/ /gi; |
| 49 | + $vclassstr =~ s/(\s+)//gi; |
| 50 | + $maxmagstr =~ s/(\s+)//gi; |
| 51 | + $min1magstr =~ s/(\s+)//gi; |
| 52 | + $min2magstr =~ s/(\s+)//gi; |
| 53 | + $epochstr =~ s/(\s+)//gi; |
| 54 | + $periodstr =~ s/(\s+)//gi; |
| 55 | + $mmstr =~ s/(\s+)//gi; |
| 56 | + $sclassstr =~ s/(\s+)//gi; |
| 57 | + $flagstr =~ s/(\s+)//gi; |
| 58 | + |
| 59 | + $designationstr =~ s/alf/α/; |
| 60 | + $designationstr =~ s/bet/β/; |
| 61 | + $designationstr =~ s/gam/γ/; |
| 62 | + $designationstr =~ s/del/δ/; |
| 63 | + $designationstr =~ s/eps/ε/; |
| 64 | + $designationstr =~ s/zet/ζ/; |
| 65 | + $designationstr =~ s/eta/η/; |
| 66 | + $designationstr =~ s/the/θ/; |
| 67 | + $designationstr =~ s/tet/θ/; # typo |
| 68 | + $designationstr =~ s/iot/ι/; |
| 69 | + $designationstr =~ s/kap/κ/; |
| 70 | + $designationstr =~ s/lam/λ/; |
| 71 | + $designationstr =~ s/mu./μ/; |
| 72 | + $designationstr =~ s/nu./ν/; |
| 73 | + $designationstr =~ s/xi./ξ/; |
| 74 | + $designationstr =~ s/omi/ο/; |
| 75 | + $designationstr =~ s/pi./π/; |
| 76 | + $designationstr =~ s/rho/ρ/; |
| 77 | + $designationstr =~ s/sig/σ/; |
| 78 | + $designationstr =~ s/tau/τ/; |
| 79 | + $designationstr =~ s/ups/υ/; |
| 80 | + $designationstr =~ s/phi/φ/; |
| 81 | + $designationstr =~ s/ksi/ξ/; |
| 82 | + $designationstr =~ s/khi/χ/; |
| 83 | + $designationstr =~ s/psi/ψ/; |
| 84 | + $designationstr =~ s/ome/ω/; |
| 85 | + $designationstr =~ s/V0/V/; # remove leading zero |
| 86 | + |
| 87 | + $ampflag = 0; |
| 88 | + if ($ampflagstr eq '(') { |
| 89 | + $ampflag = 1; |
| 90 | + } |
| 91 | + if ($ampflagstr eq '<') { |
| 92 | + $ampflag = 2; |
| 93 | + } |
| 94 | + if ($ampflagstr eq '>') { |
| 95 | + $ampflag = 3; |
| 96 | + } |
| 97 | + |
| 98 | + print OC $hipstr."\t".$designationstr."\t".$vclassstr."\t".$maxmagstr."\t".$ampflag."\t".$min1magstr."\t".$min2magstr."\t".$flagstr."\t".$epochstr."\t".$periodstr."\t".$mmstr."\t".$sclassstr."\n"; |
| 99 | +} |
| 100 | +close SC; |
| 101 | +close OC; |
0 commit comments