From 781eab46919d912a4d270812f8238ec4a3f5ebfc Mon Sep 17 00:00:00 2001 From: scottcoughlin2014 Date: Tue, 14 Aug 2018 15:46:10 -0500 Subject: [PATCH] This processes just gps time correctly --- bin/wscan | 48 ++++++++++++++++++++++---------------------- examples/wscan.param | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/bin/wscan b/bin/wscan index 2fa2efa..7da736b 100755 --- a/bin/wscan +++ b/bin/wscan @@ -54,7 +54,7 @@ def parse_commandline(): required=True) parser.add_argument("--eventTime", type=float, help="Trigger time of the glitch", required=True) - parser.add_argument("--uniqueID", action="store_true", default=True, + parser.add_argument("--uniqueID", action="store_true", default=False, help="Is this image being generated for " "the GravitySpy project, if so you must assign a " "uniqueID string to label the images instead of " @@ -147,6 +147,17 @@ def main(inifile, eventTime, project_info_pickle, ID, outDir, logger.info('You have chosen the following search range: ' '{0}'.format(searchFrequencyRange)) + ######################################################################## + # Determine if this is a normal omega scan or a Gravityspy # + # omega scan with unique ID. If Gravity spy then additional # + # files and what not must be generated # + ######################################################################## + + if uniqueID: + IDstring = ID + else: + IDstring = "{0:.2f}".format(eventTime) + ########################################################################### # create output directory # ########################################################################### @@ -155,7 +166,7 @@ def main(inifile, eventTime, project_info_pickle, ID, outDir, if outDir is None: outDirtmp = './scans' else: - outDirtmp = os.path.join(outDir, ID, ID) + outDirtmp = os.path.join(outDir, IDstring, IDstring) outDirtmp += '/' # report status @@ -166,17 +177,6 @@ def main(inifile, eventTime, project_info_pickle, ID, outDir, if verbose: logger.info('outputDirectory: {0}'.format(outDirtmp)) - ######################################################################## - # Determine if this is a normal omega scan or a Gravityspy # - # omega scan with unique ID. If Gravity spy then additional # - # files and what not must be generated # - ######################################################################## - - if uniqueID: - IDstring = ID - else: - IDstring = "{0:.2f}".format(eventTime) - ########################################################################### # Process Channel Data # ########################################################################### @@ -268,8 +268,8 @@ def main(inifile, eventTime, project_info_pickle, ID, outDir, image_data_for_si[image] = [[image_data_r, image_data_g, image_data_b]] image_data_for_cnn[image] = [image_data] - image_data_for_cnn['uniqueID'] = ID - image_data_for_si['uniqueID'] = ID + image_data_for_cnn['uniqueID'] = IDstring + image_data_for_si['uniqueID'] = IDstring # Now label the image logger.info('Labelling image...') @@ -318,7 +318,7 @@ def main(inifile, eventTime, project_info_pickle, ID, outDir, # verbose=verbose) features = pd.DataFrame(features) - features['uniqueID'] = ID + features['uniqueID'] = IDstring # Create directory called "Classified" were images that were successfully classified go. workFlow = 'Classified' @@ -330,7 +330,7 @@ def main(inifile, eventTime, project_info_pickle, ID, outDir, # determine confidence values from ML scores = scores[0].tolist() # Append uniqueID to list so when we update sql we will know which entry to update - scores.append(ID) + scores.append(IDstring) # Append label scores.append(Label) @@ -344,10 +344,10 @@ def main(inifile, eventTime, project_info_pickle, ID, outDir, subjectSetNum = workflowDictSubjectSets[iWorkflow][Label][1] break - subject1 = '{0}/{1}_{2}_spectrogram_0.5.png'.format(finalPath, detectorName, ID) - subject2 = '{0}/{1}_{2}_spectrogram_1.0.png'.format(finalPath, detectorName, ID) - subject3 = '{0}/{1}_{2}_spectrogram_2.0.png'.format(finalPath, detectorName, ID) - subject4 = '{0}/{1}_{2}_spectrogram_4.0.png'.format(finalPath, detectorName, ID) + subject1 = '{0}/{1}_{2}_spectrogram_0.5.png'.format(finalPath, detectorName, IDstring) + subject2 = '{0}/{1}_{2}_spectrogram_1.0.png'.format(finalPath, detectorName, IDstring) + subject3 = '{0}/{1}_{2}_spectrogram_2.0.png'.format(finalPath, detectorName, IDstring) + subject4 = '{0}/{1}_{2}_spectrogram_4.0.png'.format(finalPath, detectorName, IDstring) scores.append(workflowNum) scores.append(subjectSetNum) @@ -377,12 +377,12 @@ def main(inifile, eventTime, project_info_pickle, ID, outDir, engine.execute(SQLCommand) features.to_sql('similarityindex', engine, index=False, if_exists='append') elif HDF5: - scoresTable.to_hdf('{0}/ML_GSpy_{1}.h5'.format(outDir, ID), table=True, key='gspy_ML_classification') - features.to_hdf('{0}/ML_GSpy_{1}.h5'.format(outDir, ID), table=True, key='featurespace') + scoresTable.to_hdf('{0}/ML_GSpy_{1}.h5'.format(outDir, IDstring), table=True, key='gspy_ML_classification') + features.to_hdf('{0}/ML_GSpy_{1}.h5'.format(outDir, IDstring), table=True, key='featurespace') system_call = "mv {0}*.png {1}".format(outDirtmp, finalPath) os.system(system_call) - shutil.rmtree(os.path.join(outDir, ID)) + shutil.rmtree(os.path.join(outDir, IDstring)) if __name__ == '__main__': args = parse_commandline() diff --git a/examples/wscan.param b/examples/wscan.param index 1a3893e..9877935 100644 --- a/examples/wscan.param +++ b/examples/wscan.param @@ -1 +1 @@ -wscan --inifile ..//Production/wini.ini --project-info-pickle 1104.pkl --eventTime 1127700030.877928972 --outDir ./public_html/GravitySpy/Test/ --uniqueID --ID 123abc1234 --HDF5 --runML --pathToModel ../bin +wscan --inifile ..//Production/wini.ini --project-info-pickle 1104.pkl --eventTime 1127700030.877928972 --outDir ./public_html/GravitySpy/Test/ --HDF5 --runML --uniqueID --ID 123abc1234 --path-to-cnn-model ../bin/multi_view_classifier.h5 --path-to-semantic-file ../bin/semantic_idx_model.h5