Fixed poor treatment of non-tweakfiles in vib_analyze.
authorW. Trevor King <wking@drexel.edu>
Tue, 2 Dec 2008 17:05:37 +0000 (12:05 -0500)
committerW. Trevor King <wking@drexel.edu>
Tue, 2 Dec 2008 17:06:51 +0000 (12:06 -0500)
See bug 3059911a-963c-472e-a9d3-bf0a290de1a2.

calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/1d27eecf-4327-4342-bd82-41a859d33a37/body [new file with mode: 0644]
calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/1d27eecf-4327-4342-bd82-41a859d33a37/values [new file with mode: 0644]
calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/82052baf-730c-4b42-b2a0-783de0201c2f/body [new file with mode: 0644]
calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/comments/82052baf-730c-4b42-b2a0-783de0201c2f/values [new file with mode: 0644]
calibcant/.be/bugs/3059911a-963c-472e-a9d3-bf0a290de1a2/values [new file with mode: 0644]
calibcant/vib_analyze.py

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 (file)
index 0000000..aa78d62
--- /dev/null
@@ -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 <module>
+    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 (file)
index 0000000..b73f5de
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Tue, 02 Dec 2008 16:39:45 +0000
+
+
+
+
+
+
+From=W. Trevor King <wking@drexel.edu>
+
+
+
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 (file)
index 0000000..dbe1594
--- /dev/null
@@ -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
+"<frequency_Hz>\t<deflection_psd X^2/Hz>\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 (file)
index 0000000..40e7feb
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Tue, 02 Dec 2008 17:05:09 +0000
+
+
+
+
+
+
+From=W. Trevor King <wking@drexel.edu>
+
+
+
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 (file)
index 0000000..8984096
--- /dev/null
@@ -0,0 +1,35 @@
+
+
+
+creator=W. Trevor King <wking@drexel.edu>
+
+
+
+
+
+
+severity=minor
+
+
+
+
+
+
+status=fixed
+
+
+
+
+
+
+summary=Error vib-fitting a single file
+
+
+
+
+
+
+time=Tue, 02 Dec 2008 16:39:18 +0000
+
+
+
index 4c2843526d91bedf690cb6a848f0b8492e0954bc..283f1ae49d8b389cf549c497162c1c32e6ae7f0a 100755 (executable)
@@ -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)'
-                    '<input-file> should be whitespace-delimited, 2 column ASCII\n'
-                    'without a header line.\n'
-                    'e.g: "<frequency_Hz>\\t<deflection_psd X^2/Hz>\\n"\n')
+                    'and returns the variance in X units (X^2)\n'
+                    '<input-file> should be 1 column ASCII without a header line.\n'
+                    'e.g: "<deflection bits>\\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)