Skip to content

Commit

Permalink
First spectra type ingest attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
LishaRamon committed Dec 27, 2023
1 parent 1988469 commit bc790e5
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions scripts/ingests/ingest_bard14_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,49 @@
# LOAD THE DATABASE
db = load_simpledb('SIMPLE.db', recreatedb=RECREATE_DB)

# SPECTRAL TYPES
#Find how to read data from folder
bard14 = ascii.read()

# Read in file as Astropy table (Not sure how to ingest a folder, dont use csv)
# file = 'bard14.csv'
file = 'bard14.csv'
data = Table.read('scripts/ingests/' + file)

# print result astropy table
print(bard14.info)

#Ingest spectral types
#Loop through data
def ingest_all_spectral_types(db):
for row in file[1:90]:

# Print spectral type information
print("Spectral Type Information:")

for col_name in row.colnames:
print(f"{col_name}: {row[col_name]}")


print("-" * 20)

#Call spectral types function
ingest_all_spectral_types(db)


# Ingest SPECTRAL TYPES, loop through data
ingest_spectral_types(db,
sources = " ",
spectral_types= " ",
references = " ",
regimes = " ",
spectral_type_error=None,
comments=None)
comments=None)

#Idea to open a fits file
#from astropy.io import fits
#fits_image_filename = fits.util.get_testdata_filepath('test0.fits')
#hdul = fits.open(fits_image_filename)

# WRITE THE JSON FILES
if SAVE_DB:
db.save_database(directory="data/")

0 comments on commit bc790e5

Please sign in to comment.