rdemaria / pytimber

Python Wrapping of CALS API
12 stars 23 forks source link

first version of class BSRT #24

Closed mfittere closed 7 years ago

mfittere commented 7 years ago

Here a first version of the BSRT class. You can try it with e.g.:

t1=pytimber.parsedate("2016-08-24 05:32:00.000")
t2=pytimber.parsedate("2016-08-24 05:33:00.000")
data=pytimber.BSRT.fromdb(t1,t2,beam='B1')

In case no database is specified, it generates it: if db==None: db=pytimber.LoggingDB() We could also add a method of the db directly, e.g.: db.getbsrt(t1,t2,beam='B1') which calls pytimber.BSRT.fromdb(t1,t2,beam='B1',db=db)

I added an additional file toolbox.py with useful functions. I would keep those separate as they might be reused also for other postprocessing classes.

Please have a look at the code. I just basically copied and pasted what I had with some minor modificiations, it might still need some clean up.

rdemaria commented 7 years ago

Few comments:

why as os in import os as os

I like a style in which you can write:

bsrt=pytimber.BSRT.fromdb(t1,t2,beam='B1').fit(...).plot(...)

In this case you save the data in the class and you return the class itself. The advantage is that you can hide the way the data is represented inside the class, you have access to intermediate steps if needed and you have compact code. A bit of docstring should help in finding where find the data in the class.

The __init__ method should contain all the data needed to clone the state of the object. I would default post-processed data with None.

mfittere commented 7 years ago
mfittere commented 7 years ago

We should then also check this with Georges and Enrico as it is then sth. more official and it would be good to get their approval.

mfittere commented 7 years ago

I rewrote parts of the codes, some additional comments/questions: