j@219: (cl:in-package #:amuse-utils) j@219: j@219: (defun beats->seconds (composition &optional (stream t)) j@219: "Prints a table of beat timepoints in seconds." j@219: (loop for i from 0 to (timepoint (cut-off composition)) j@219: do (format stream j@219: "~A~C~F~%" i #\Tab j@219: (amuse-utils:beats-to-seconds j@219: (make-moment i) composition)))) j@219: j@219: (defun export-data-from-composition (function composition pathname) j@219: "Function that applies another function to a composition, witing j@219: the output to a file, e.g. use this to call beats->seconds." j@219: (with-open-file (stream pathname j@219: :direction :output j@219: :if-exists :supersede) j@219: (funcall function composition stream))) j@219: j@219: (defun export-data-from-dataset (dataset function pathname) j@219: "Same as above except that processes an entire amuse-dataset." j@219: (loop for composition-identifier in j@219: (%list-slot-sequence-data dataset) j@219: do (with-open-file (stream j@219: (concatenate 'string pathname j@219: (princ-to-string j@219: (composition-id j@219: composition-identifier))) j@219: :direction :output j@219: :if-exists :supersede) j@219: (funcall function j@219: (get-composition composition-identifier) stream))))