Added writing of PV diagram 

We may want to make this addition a separate module, but for the moment PV diagrams are created everytime cubelets are.