我正在尝试在python(或ipython)中找到idl's journal的等效功能。我知道 ipython 有 %logstart 函数,但它只记录 ipython 中的输入/输出,所以如果我运行我的脚本并要求我输入值,这些不会进入日志。当我运行 EELTnoM6.py 脚本时,这里是我的终端:
In [11]: run EELTnoM6
################################################################
## STOKES vector after the system ##
################################################################
== Demodulation matrix ==
Automatic: A
ZIMPOL/EELT: Z
EELT IF Eif
Custom C
Demodulation matrix?: C
Efficiency of the detector?: 1.
Demodulation matrix? (e.g. [ [1.,0.],[0.,1.] ]): [[1/6.,1/6.,1/6.,1/6.,1/6.,1/6.], [0.5,-0.5,0.,0.,0.,0.],[0.,0.,-0.5,0.5,0.,0.],[0.,0.,0.,0.,-0.5,0.5]]
ModelStokesMeasurement time = 65.6509261131
Simulation time = 151.731481075
这是我在日志中得到的:
# IPython log file
%logstart -o -r EELTnoM6_log rotate
ls
%logstop
run EELTnoM6
%logoff
我想将脚本询问时给出的输入存储在日志中,即
Demodulation matrix?: C
Efficiency of the detector?: 1.
Demodulation matrix? (e.g. [ [1.,0.],[0.,1.] ]): [[1/6.,1/6.,1/6.,1/6.,1/6.,1/6.],[0.5,-0.5,0.,0.,0.,0.],[0.,0.,-0.5,0.5,0.,0.],[0.,0.,0.,0.,-0.5,0.5]]
所以 C, 1. 和矩阵能够以相同的值再次运行它。这在 IDl 中非常容易,所以当我找不到 ipython 的相同内容时,我感到非常惊讶......