-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
StarSearch/starsearch/phase3Archive.py
Lines 548 to 575 in e47d0d9
| try: | |
| fileName = np.array(search['ARCFILE']) | |
| spectrograph = np.array(search['Instrument']) | |
| obsDate = np.array(search['Date Obs']) | |
| snr = np.array(search['SNR (spectra)']) | |
| #number of spectra | |
| print('Total number of spectra found: {0}'.format(snr.size), file = f) | |
| value, count = np.unique(spectrograph, return_counts=True) | |
| for i in range(value.size): | |
| specSNR = search[search['Instrument']==value[i]]['SNR (spectra)'] | |
| quadSum = np.sqrt(np.sum(specSNR**2)) | |
| print('\n{0} spectra: {1}'.format(value[i], count[i]), '|', | |
| 'SNR Quadradratic Sum: {0}'.format(quadSum), file = f) | |
| comparison = search[search['Instrument']==value[i]]['SNR (spectra)'] | |
| maxSNRpos = np.argmax(comparison) | |
| print('Maximum SNR: {0}'.format(comparison[maxSNRpos]), file=f) | |
| minSNRpos = np.argmin(comparison) | |
| print('Minimum SNR: {0}'.format(comparison[minSNRpos]), file=f) | |
| #spectra found | |
| if printFiles: | |
| print('ARCFILE\tInstrument\tObservationDate\tSNR', file = f) | |
| for i, j in enumerate(fileName): | |
| print('{0}\t{1}\t{2}\t{3}'.format(j, spectrograph[i], | |
| obsDate[i], snr[i]), file = f) | |
| if saveFile: | |
| f.close() | |
| except: | |
| print('{0} not found in archive\n'.format(star), file = f) |
Comment on this part of the code:
This try except is a "bit" to large, the exception catch everything, the message might be misleading.
You need to include the try only where the specific problem might occur, or alternative, you have to catch the correct exception...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels