Created
November 8, 2014 06:59
-
-
Save timsgardner/f2d6c14016b4fc7ac518 to your computer and use it in GitHub Desktop.
starparse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.string :as s]) | |
(set! *print-length* nil) | |
(def starspeck-raw | |
(vec | |
(s/split-lines | |
(slurp "/Volumes/DUv3_9pview/Digital Universe/data/milkyway/specks/stars.speck")))) | |
(let [fields | |
[:x :y :z :colorb-v :lum :absmag :appmag :texnum :distly :dcalc :plx :plxerr :vx :vy :vz :speed :hipnum]] | |
(spit "starspeck.edn" | |
(pr-str | |
(vec | |
(for [spcstr (drop 29 starspeck-raw)] | |
(->> (s/split spcstr #"\s+") | |
rest | |
(take 16) | |
(map #(System.Double/Parse %)) | |
(zipmap fields))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment