Skip to content

Commit

Permalink
This processes just gps time correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
scottcoughlin2014 committed Aug 14, 2018
1 parent 00d7234 commit 781eab4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
48 changes: 24 additions & 24 deletions bin/wscan
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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 #
###########################################################################
Expand All @@ -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
Expand All @@ -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 #
###########################################################################
Expand Down Expand Up @@ -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...')
Expand Down Expand Up @@ -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'
Expand All @@ -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)

Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion examples/wscan.param
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 781eab4

Please sign in to comment.