-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeplerIDExtractor.py
More file actions
32 lines (25 loc) · 988 Bytes
/
KeplerIDExtractor.py
File metadata and controls
32 lines (25 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Program to extract Kepler IDs from a .tsv generated by Vizier
# Carly Hessler
# 10/14/2014
import csv
import numpy as np
keplerList = []
def reader(fileName):
with open(fileName, 'rU') as csvfile:
starReader = csv.reader(csvfile, delimiter=';')
starReader.next()
i = 0 # necessary as I am a bad programmer
for row in starReader:
if row and i > 34: # this isn't good coding, I'm aware, but it works
print row
keplerList.append(row)
i += 1
# note that at the end, i will be OVER NINE THOUSAAAAND. VizieR spits out blank rows which I removed
def writeToFile(fileName):
writer = csv.writer(open(fileName, "wb"))
for row in keplerList:
writer.writerow(row)
np.set_printoptions(threshold='nan')
reader('C:/Users/cahessler3098/Downloads/fgcu-stellar-research/Carly\'s Work/Cooler Stars Work/KeplerIDExtractor/asu.tsv')
print(len(keplerList))
writeToFile('KIDs.csv')