def view_spectrum(): conn = sqlite3.connect(os.path.join(BASE_DIR, 'data.db')) c = conn.cursor() materials = c.execute("""SELECT DISTINCT material FROM main ORDER BY material;""") materials = dict(enumerate([material[0] for material in materials.fetchall()], start=1)) print("Select a Material:") for number, material in materials.items(): print ('{} - {}'.format(number, material)) spectrum = raw_input("Enter Selection: ") print('\n') if spectrum.isdigit() and int(spectrum) in materials.keys(): rs.plot({'material': Material(materials[int(spectrum)])})
def view_spectrum(): conn = sqlite3.connect(os.path.join(BASE_DIR, 'data.db')) c = conn.cursor() materials = c.execute( """SELECT DISTINCT material FROM main ORDER BY material;""") materials = dict( enumerate([material[0] for material in materials.fetchall()], start=1)) print("Select a Material:") for number, material in materials.items(): print('{} - {}'.format(number, material)) spectrum = raw_input("Enter Selection: ") print('\n') if spectrum.isdigit() and int(spectrum) in materials.keys(): rs.plot({'material': Material(materials[int(spectrum)])})
def execute(self): ## GENERATE REFLECTANCE CURVE PLOT print("Start by reviewing the reflectance curves.\n") rs.plot(self.base_materials) ## CREATE BANDS print("Create your bands.") bands = rs.create_bands() ## SHADE BANDS ON REFLECTANCE PLOT rs.plot(self.base_materials, bands, show_bands=True) ## GENERATE PIXEL VALUES if self.terrain is None: self.generate_terrain(self.spectral_mixing['mixing'], self.spectral_mixing['constrained']) self.image = rs.get_image(self.terrain, bands) self.display()
print("Scenario options:\n") menu_count = 1 for s in scenarii: print("{} - {}".format(menu_count, s.name)) menu_count += 1 print("{} - View Spectrum".format(menu_count)) print("Q - quit") selection = raw_input("Enter a selection: ") print('\n') if selection.isdigit() and selection in valid_scenarios: scenario = scenarii[int(selection)-1] print("Launching {}".format(scenario.name)) scenario.execute() elif selection.isdigit() and selection == '5': conn = sqlite3.connect('data.db') c = conn.cursor() materials = c.execute("""SELECT DISTINCT material FROM main ORDER BY material;""") materials = dict(enumerate([material[0] for material in materials.fetchall()], start=1)) print("Select a Material:") for number, material in materials.items(): print ('{} - {}'.format(number, material)) spectrum = raw_input("Enter Selection: ") print('\n') if spectrum.isdigit() and int(spectrum) in materials.keys(): sensing.plot({'material': Material(materials[int(spectrum)])}) print("Done!\n")
menu_count = 1 for s in scenarii: print("{} - {}".format(menu_count, s.name)) menu_count += 1 print("{} - View Spectrum".format(menu_count)) print("Q - quit") selection = raw_input("Enter a selection: ") print('\n') if selection.isdigit() and selection in valid_scenarios: scenario = scenarii[int(selection) - 1] print("Launching {}".format(scenario.name)) scenario.execute() elif selection.isdigit() and selection == '5': conn = sqlite3.connect('data.db') c = conn.cursor() materials = c.execute( """SELECT DISTINCT material FROM main ORDER BY material;""") materials = dict( enumerate([material[0] for material in materials.fetchall()], start=1)) print("Select a Material:") for number, material in materials.items(): print('{} - {}'.format(number, material)) spectrum = raw_input("Enter Selection: ") print('\n') if spectrum.isdigit() and int(spectrum) in materials.keys(): sensing.plot({'material': Material(materials[int(spectrum)])}) print("Done!\n")
from materials import materials from sensing import get_image, create_grid, plot, Band ##### ## GENERATE REFLECTANCE CURVE PLOT ##### plot(materials) ##### ## CREATE BANDS ##### print("Create your bands.") selection = None band = 1 bands = [] while selection not in ['q', 'Q']: print("""Band creation options: 1 - Create New Band Q - Quit and proceed """) if bands: print("Current Bands") for b in bands: print("Band Number {}: {}nm to {}nm".format(b.number, b.start_lambda, b.stop_lambda)) print("")