3 Oscopy is designed to be easily extendable. Support of new data file formats is
4 done by adding new Readers/Writers, new types of Graph and Figures by deriving
7 New data file format can be added by deriving Reader and
8 redefining the function readsigs(), which fills the list
9 of signals self.sigs and return a dict of signals.
10 During execution, Reader.read() check the validity
11 of the provided path, and then call readsigs().
13 New graph mode can be added by deriving Graph and redefining
14 the function set_axes() which if called by plot(), or eventually
15 redefining plot(). See FFTGraph.py for example.
16 NOTE : Figure.set_mode() has to be updated when new mode are added !
19 A figure is CREATEd or DESTROYed, a graph is ADDed to a figure or DELETEd and a
20 signal is INSERTed or REMOVEd from a graph.
22 Template for new import format:
27 class xxxReader(Readers.Reader.Reader):
29 #[...] read the signals data from file and for each signal:
31 # Reference signal, or X axis
32 sref = Signal("name_ref", self, "unit_ref")
33 sref.set_pts([with X data from file as a list or numpy.array])
35 s = Signal("name_sig", self, "unit_sig")
36 s.set_pts([with data from file as a list or numpy.array])
37 # Assign reference to signal
42 #and return a dict of sigs where key is signal name
46 # return True if file fn can be read using this Reader
48 When a importing a signal, first detect is called.
49 If format is supported, read() and subsequent update() will call readsigs()
51 Template for new export format:
56 class xxxWriter(Writers.Writer.Writer):
58 ... return a string containing the name of the format
60 def fmtcheck(self, sigs):
61 ... return True if format can be use to write dict of signals sigs
63 def writesigs(self, sigs)
64 ... write signals to file
66 When an export command is issued, the format name is compared to the
67 one provided by the class, and then the signals are passed to the class
68 to check whether it can write them properly, e.g. if they have the same
69 abscisse. If eveyrthing is fine, writesigs() is called.
70 Options passed by user can be found in self.opts.
72 Template for new graphs:
77 class xxxGraph(Graphs.Graph.Graph):
79 ... define the plot function, using signals in self.sigs
85 READER -- SIGNAL+ + FIGURE +-- GRAPH +-- SIGNAL
86 \- SIGNAL+ | | +-- SIGNAL
88 | | +-- GRAPH +-- SIGNAL