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