diff --git a/scripts/ingests/ingest_bard14_spectra.py b/scripts/ingests/ingest_bard14_spectra.py index 81031b12b..6f3b3c92f 100644 --- a/scripts/ingests/ingest_bard14_spectra.py +++ b/scripts/ingests/ingest_bard14_spectra.py @@ -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) \ No newline at end of file + 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/") \ No newline at end of file