Python real time class methods
Python is a great programming language with countless merits. However, one short coming (compared with Matlab e.g.) is that one often has to restart the program in order to refresh the modified the code, which is kind of a hassle. Below, I will show what I did to circumvent this problem. Basically, I define the class method in another file, say methods.py, which is different from the file that contains the definition of the class, say myclass.py. Then I found a way to reload (or redefine) all the instance (or class) methods.
class MyClass():
def __init__(self):
import methods as methods;
self.add_extended_methods(methods);
pass;
def add_extended_methods(self, methods):
import inspect;
if not methods.lazy:
reload(methods);
self.methods=methods;
modulefile=inspect.getfile(methods);
modulefile=modulefile.replace('.pyc','.py');
for k in methods.__dict__.keys():
expr="methods."+k;
v=eval(expr);
if inspect.isfunction(v) and inspect.getfile(v)==modulefile:
cmd="def "+k+"(self,*args, **kwargs):return self.methods."+k+"(self,*args, **kwargs);"
exec(cmd);
import new;
cmd="self."+k+"=new.instancemethod("+k+", self, MyClass)";
exec(cmd);
One can also call the "add_extended_methods" anytime when he wants to use updated methods.
This saved me a lot of time from restarting the whole Python/Program
Friday, August 28, 2009
Wednesday, August 12, 2009
Parameters of multiferroics:
Parameters of multiferroics:
[Xu2008] Charge Order, Dynamics, and Magnetostructural Transition in Multiferroic LuFe2O4
Author(s): Xu XS, Angst M, Brinzari TV, et al.
Source: PHYSICAL REVIEW LETTERS Volume: 101 Issue: 22 Article Number: 227602 Published: NOV 28 2008
[Xu2009] Optical properties and magnetochromism in multiferroic BiFeO3
Author(s): Xu XS, Brinzari TV, Lee S, et al.
Source: PHYSICAL REVIEW B Volume: 79 Issue: 13 Article Number: 134425 Published: APR 2009
Type | Name | TC (K) | TN (K) | Polarization (uC/cm^2) | Critical field | Other critical temperatures | |||
I.1 Lone pair FE | BiFeO3 | 1100 | 640 | 100 | 20 T quenching spiral, 10 T spiral rotation [Xu2009] | 140 K spin reorientation | |||
I.2 Geometric FE | YMnO3 | 1200 | 42 | 5 | |||||
II.1 Valence order of magnetic ions | LuFe2O4 | 320 | 240 | 25 | see phase diagram of [Xu2008] | ||||
III.1 Spiral Magnets | TbMnO3 | 41 | 28 | 6e-2 | |||||
III.2 frustrated collinear M | Ca3CoMnO6 | 16.5 | 16.5 | 9e-2 | |||||
[Xu2008] Charge Order, Dynamics, and Magnetostructural Transition in Multiferroic LuFe2O4
Author(s): Xu XS, Angst M, Brinzari TV, et al.
Source: PHYSICAL REVIEW LETTERS Volume: 101 Issue: 22 Article Number: 227602 Published: NOV 28 2008
[Xu2009] Optical properties and magnetochromism in multiferroic BiFeO3
Author(s): Xu XS, Brinzari TV, Lee S, et al.
Source: PHYSICAL REVIEW B Volume: 79 Issue: 13 Article Number: 134425 Published: APR 2009
classes of multiferroics
category of multiferroics
Type-I FE, M order from different subsystem Tc>>TN | Type-II FE, M order from same subsystem, but independent origin Tc>TN | Type-III FE caused by M order TC<=TN | |
SubType: | I.1 Lone pair FE | II.1 Valence order of magnetic ions | III.1 Spiral Magnets |
Example: | BiFeO3 TC: 1100 TN: 640 K P: 100uC/cm^2 [Xu2009Ref] Intro: perovskite, A disp along (111) | LuFe2O4 TCO: 320 K TN: 240 K [Xu2008] P: 25 uC/cm2 | TbMnO3 TN=41K TC=28K P: 6e-2 [Kimura2007] Intro: inverse Dzyaloshinskii–Moriya effect. P~Qxe, where three symbols are ploarization, spiral propagation direction and normal vector of the spiral plan |
Other Examples: | {BiMnO3, PbVO3} | Ni3V2O6, MnWO4, CuO orthorhombic RMnO3 (R=Tb,Dy) | |
SubType: | I.2 Geometric FE | III.2 frustrated collinear M | |
Example | YMnO3 TC: 1200 K TN: 42 K P: 5 μC/cm^2 [VanAken2004] Intro: perovskite, BO6 title, then A goes up and down asymmetrically | Ca3CoMnO6 TN, TC=16.5 K, P: 9e-2 uC/cm2 Intro: magnetostriction | |
Other Examples: | hexagonal RMnO3 (R=Ho-Lu) | RMn2O5 (R=Pr-Lu, Bi,Y) |
[Kimura2007] Spiral magnets as magnetoelectrics
Author(s): Kimura T
Source: ANNUAL REVIEW OF MATERIALS RESEARCH Volume: 37 Pages: 387-413 Published: 2007
[VanAken2004] The origin of ferroelectricity in magnetoelectric YMnO3
Author(s): Van Aken BB, Palstra TTM, Filippetti A, et al.
Source: NATURE MATERIALS Volume: 3 Issue: 3 Pages: 164-170 Published: MAR 2004
[Xu2008] Charge Order, Dynamics, and Magnetostructural Transition in Multiferroic LuFe2O4
Author(s): Xu XS, Angst M, Brinzari TV, et al.
Source: PHYSICAL REVIEW LETTERS Volume: 101 Issue: 22 Article Number: 227602 Published: NOV 28 2008
[Xu2009] Optical properties and magnetochromism in multiferroic BiFeO3
Author(s): Xu XS, Brinzari TV, Lee S, et al.
Source: PHYSICAL REVIEW B Volume: 79 Issue: 13 Article Number: 134425 Published: APR 2009
Subscribe to:
Posts (Atom)