From: W. Trevor King Date: Tue, 2 Dec 2008 17:05:37 +0000 (-0500) Subject: Fixed poor treatment of non-tweakfiles in vib_analyze. X-Git-Tag: 0.3~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8adf9c86e131d2a5e960e4e9ce6ccbb16535227d;p=calibcant.git Fixed poor treatment of non-tweakfiles in vib_analyze. See bug 3059911a-963c-472e-a9d3-bf0a290de1a2. --- diff --git a/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/1d27eecf-4327-4342-bd82-41a859d33a37/body b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/1d27eecf-4327-4342-bd82-41a859d33a37/body new file mode 100644 index 0000000..aa78d62 --- /dev/null +++ b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/1d27eecf-4327-4342-bd82-41a859d33a37/body @@ -0,0 +1,10 @@ +$ cc_vib_analyze.py -m 300 -M 7000 ~/rsrch/data/z_piezo_calib/20080919/20080919121041_zp_time_50000Hz +Traceback (most recent call last): + File "/home/wking/script/lab/cc_vib_analyze.py", line 442, in + data = read_data(ifilename) + File "/home/wking/script/lab/cc_vib_analyze.py", line 374, in read_data + unlabeled_data=scipy.io.read_array(ifile) + File "/usr/lib/python2.5/site-packages/scipy/io/array_import.py", line 385, in read_array + outarr[k][row] = vals[k] +ValueError: shape mismatch: objects cannot be broadcast to a single shape + diff --git a/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/1d27eecf-4327-4342-bd82-41a859d33a37/values b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/1d27eecf-4327-4342-bd82-41a859d33a37/values new file mode 100644 index 0000000..b73f5de --- /dev/null +++ b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/1d27eecf-4327-4342-bd82-41a859d33a37/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Tue, 02 Dec 2008 16:39:45 +0000 + + + + + + +From=W. Trevor King + + + diff --git a/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/82052baf-730c-4b42-b2a0-783de0201c2f/body b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/82052baf-730c-4b42-b2a0-783de0201c2f/body new file mode 100644 index 0000000..dbe1594 --- /dev/null +++ b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/82052baf-730c-4b42-b2a0-783de0201c2f/body @@ -0,0 +1,14 @@ +Ahh, I didn't read my own help command, and it was wrong anyway :p. +Now that it's corrected, you can fit a single vibration timeseries with + +$ int16_to_ascii ~/rsrch/data/z_piezo_calib/20080919/20080919121041_zp_time_50000Hz > di +$ cc_vib_analyze.py -m 300 -M 7000 -f 50000 -p -G di + +or + +$ cc_vib_analyze.py -m 300 -M 7000 -f 50000 -p -G -d ~/rsrch/data/z_piezo_calib/20080919/20080919121041_zp_time_50000Hz + +Perhaps someone will add support for the +"\t\n" +format later... + diff --git a/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/82052baf-730c-4b42-b2a0-783de0201c2f/values b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/82052baf-730c-4b42-b2a0-783de0201c2f/values new file mode 100644 index 0000000..40e7feb --- /dev/null +++ b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/82052baf-730c-4b42-b2a0-783de0201c2f/values @@ -0,0 +1,21 @@ + + + +Content-type=text/plain + + + + + + +Date=Tue, 02 Dec 2008 17:05:09 +0000 + + + + + + +From=W. Trevor King + + + diff --git a/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/values b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/values new file mode 100644 index 0000000..8984096 --- /dev/null +++ b/calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/values @@ -0,0 +1,35 @@ + + + +creator=W. Trevor King + + + + + + +severity=minor + + + + + + +status=fixed + + + + + + +summary=Error vib-fitting a single file + + + + + + +time=Tue, 02 Dec 2008 16:39:18 +0000 + + + diff --git a/calibcant/vib_analyze.py b/calibcant/vib_analyze.py index 4c28435..283f1ae 100755 --- a/calibcant/vib_analyze.py +++ b/calibcant/vib_analyze.py @@ -382,10 +382,9 @@ if __name__ == '__main__' : '2008, W. Trevor King.\n' '\n' 'Deflection power spectral density (PSD) data (X^2/Hz)\n' - 'and returns the variance in X units (X^2)' - ' should be whitespace-delimited, 2 column ASCII\n' - 'without a header line.\n' - 'e.g: "\\t\\n"\n') + 'and returns the variance in X units (X^2)\n' + ' should be 1 column ASCII without a header line.\n' + 'e.g: "\\n..."\n') parser = OptionParser(usage=usage_string, version='%prog 0.1') parser.add_option('-f', '--sample-freq', dest='freq', default=100e3, help='sample frequency in Hz (default %default)', @@ -414,6 +413,9 @@ if __name__ == '__main__' : parser.add_option('-t', '--tweak-mode', dest='tweakmode', action='store_true', help='Run in tweak-file mode', default=False) + parser.add_option('-d', '--datalogger-mode', dest='datalogger_mode', action='store_true', + help='Read input files with datalogger.read_dict_of_arrays(). This is useful, for example, to test a single line from a tweakfile.', + default=False) parser.add_option('-v', '--verbose', dest='verbose', action='store_true', help='Print lots of debugging information', default=False) @@ -439,8 +441,11 @@ if __name__ == '__main__' : PLOT_GUESSED_LORENTZIAN = options.plot_guess if options.tweakmode == False : - data = read_data(ifilename) - deflection_bits = data['Deflection input'] + if options.datalogger_mode: + data = vib_load(ifilename) + deflection_bits = data['Deflection input'] + else: + deflection_bits = read_data(ifilename) Vphoto_var = vib_analyze(deflection_bits, freq=options.freq, minFreq=options.min_freq, maxFreq=options.max_freq)