0%

Python的文件类型

源代码

后缀以py结束的文件,比如下面的文件python_helloworld.py。

1
2
if __name__ == "__main__":
print ("Hello World")

字节代码

可以通过两种方法来编译为字节代码,直接用下面的命令或者脚本,
执行后会生成一个后缀为pyc的文件

转换命令

1
$ python -m py_compile python_helloworld.py

转换脚本

1
2
import py_compile
py_compile.compile('python_helloworld.py')

优化代码

扩展名为pyo,o的意思就是优化过的代码,使用的方法如下:

1
$ python -O -m py_compile python_helloworld.py

第一个Python程序

Python的源代码文件以py作为后缀,命名为python_helloworld.py,先写一个最简单的程序。

1
2
if __name__ == "__main__":
print ("Hello World")

可以在终端中直接用python来执行这个程序

1
$ python python_helloworld.py

Python历史及由来

有Guido van Rossum在1989年开发,并与1991年初发表。

属于解释型语言,比Java可读性更强。

Softc: an Operational Software Correlator

By Stephen T. Lowe

概要

Softc相关精度低于10-13秒。该程序可以关联真正的USB,真正的LSB或复杂的I/Q数据采样,支持1、2、4、8比特分辨率。

最近在一个Intel的CPU显示的softc时序测试处理延迟为8的1比特采样的采样率在10 M样点/秒。

介绍

处理机只能定制,价格昂贵,维护和开发也需要很多费用。

解决方案:①用磁盘取代磁带;②用通用计算机取代定制硬件。

历史

Softc历经艰难险阻。

功能

Softc可移植性很好。softc的输入和输出数据格式十分简单,所以需要一个翻译程序来做一些转换。

代码调试

softc创造了一个完整的蒙地卡罗数据发生器,该模拟发生器可以产生VLBI数据,然后通过softc处理,从而与通过预期的结果(可以被精确计算的先验,并从这些结果中的任何偏差表示与该相关的问题。)相比较,从而找到相关器的问题所在。

softc蒙特卡洛模拟数据有两种方法:

  • 第一个是一个工程模式,通过用户选择的延迟,延迟率,分数采样偏移等产生数据;
  • 第二个是使用相关模型模拟数据。

在完整的代码测试中,我们发现蒙地卡罗无法检测到由于建模错误而导致的错误。

喷气推进实验室的未来发展方向

部署softc软件、Fit(后相关软件)及Modest(参数估计软件)

总结

softc的创建尽可能准确,基本上可以处理任何VLBI数据,用最通用的语言编写,且已被用于为航天器的导航业务2年以上,并将用于明年喷气推进实验室的Mark5相关。

原文Softc: an Operational Software Correlator

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
By Stephen T. Lowe


Jet Propulsion Laboratory / California Institute of Technology

IVS 2004 General Meeting Proceedings

Abstract:

Softc has been used operationally for spacecraft navigation at JPL for over 2 years and will be JPL’s Mark 5 correlator next year. Softc was written to be as close to an ideal correlator as possible, making approximations only below clip_image001 seconds. The program can correlate real USB, real LSB, or complex I/Q data sampled with 1, 2, 4, or 8-bit resolution, and was developed with strong debugging tools that made final debugging relatively quick. Softc’s algorithms and program structure are fully documented. Timing tests on a recent Intel CPU show Softc processes 8 lags of 1-bit sampled data at 10 MSamples/sec, independent of sample rate.

1. Introduction

Level-one VLBI processing has traditionally required state-of-the-art processing power and data bandwidths that could only be implemented using custom electronic hardware and data storage equipment. These devices, correlators, often took many years to design and build followed by at least a year of use to excise the more obvious processing problems. This long development time also ensured that by the time a correlator was debugged and in a stable operational mode its equipment was obsolete. Because there was no other processing option, the VLBI community has endured high costs associated with these devices. These costs include many millions of dollars for development, on the order of $1M annually to pay for the ongoing debugging, capability improvements, and maintenance, a trained operator staff, and the infrastructure costs of the correlator room such as leasing, power, and air conditioning. Data storage and transport has used custom tape technology, but this is also expensive, and as the technology has been pushed to higher densities, tape drive/head maintenance costs have increased. Finally, some indirect correlator costs include lack of flexibility for novel experimental setups, lack of transparent processing algorithms, lack of repeatable output due to tape playback errors, and downtime for maintenance, testing, and modifications.

It has been known for some time that all the disadvantages of the traditional correlator noted above could be eliminated if efficient data handling could be moved from tape to disk, and general-purpose computers could meet the processing requirements. Until recently, neither of these conditions could be met adequately, but interestingly it now appears the crossover points for both of these competing technologies, custom tape vs. disk, and custom hardware vs. general-purpose computer, is in the recent past. Both the recent Mark 5 disk format and software correlators such as Softc take advantage of huge commercial R&D budgets worldwide. These are cases of custom VLBI hardware capabilities being overtaken by commercial products developed with enormous resources compared to those in the VLBI community. By extrapolation we are likely to experience other paradigm shifts soon in the remaining custom VLBI hardware, namely station electronics. We are also beginning to see how all these changes are significantly altering the optimum values of VLBI system parameters. For example, it will be more efficient to have smaller antennas with higher bandwidths, and reliability should increase with the improved hardware, disk storage, and real-time fringe verification.

2. History

In 1995 JPL began to decommission its Delta-Differenced One-way Range (DeltaDOR) spacecraft navigation system. The decommissioning process was to mothball the DeltaDOR capability, eliminate its near real-time Block I hardware correlator, and after a short time cease DeltaDOR funding. At around this same time, test programs were written to assess software correlation speed and to find fringes in old Block I quasar data. These tests showed the Block I bandwidths were low enough that it could be replaced with a software correlator. Since there was no other choice to preserve this capability, a project to replace the Block I with a software correlator began in 1996. This task was essentially completed but since this was a mothballing effort and DeltaDOR was not necessary for any mission, the program, called Softc, was never used. This was probably fortunate as the program, by design, exactly duplicated the Block I processing including its many approximations and flaws. In 1998, the RadioAstron project agreed to fund further development of Softc as a debugging tool for their project. This opportunity was used to essentially start over and build a true software correlator with all its intrinsic advantages without being constrained to a hardware correlator’s shortcomings. Unfortunately, this effort was canceled in 1999 just as full code testing began. Softc then remained complete but unused and untested until 2001 when the mis-navigation and demise of Mars Climate Orbiter prompted JPL to resurrect the DeltaDOR navigation technique. Softc underwent full-code testing using geodetic experiments and DeltaDOR passes of Mars Global Surveyor, in orbit at the time, and Mars Odyssey, which was on its way to Mars at the time. Softc’s first critical use was the successful Mars Odyssey orbit insertion in Oct 2001. Softc has also been used to successfully navigate both Mars Exploration Rover missions, Deep Space 1, Europe’s Mars Express, and Japan’s Nozomi and Muses-C (Hayabusa) missions.

3. Capabilities

Softc was designed to be as close as possible to an ideal correlator, where ideal refers to processing accuracy; no compromise in accuracy greater than clip_image001[1] sec was made to increase performance (or for any other reason). Softc can correlate 1, 2, 4, and 8-bit sampled data, upper, lower or double (I/Q) sideband data, and data using either of two sample encoding schemes. Softc is quite portable, as it was developed on a little-endian Alpha running VMS, it works operationally on a large endian machine running Solaris, and has been tested on little-endian Intel machines running Linux. It produces identical output on these machines with no code modifications, even with different C compilers.

Softc was designed to process essentially any VLBI data. To do this and remain independent of the hardware and post-correlation software interfaces, Softc has its own input and output data formats. These formats were designed to be as simple as possible, but a translation program is needed to convert the sampled data into Softc’s format, and another program is needed to translate from Softc’s output to the desired post-correlation format. It is also possible to place these translators inside Softc; this has been done on the output side for our DeltaDOR effort and will likely be done for Softc’s input in the future.

4. Code Debugging

One of the greatest hurdles in developing a VLBI correlator is the elimination of processing errors and inaccuracies. It is common for hardware correlator developers to spend years tracking down reasonably significant bugs. Also common are correlator users finding new, consequential errors long after all known problems were eliminated. An important limitation for correlator developers has been the lack of good debugging tools. For this reason, a significant effort, perhaps 40% of Softc’s development, went into the creation of a full Monte Carlo data generator. This generator creates simulated VLBI data that can then be processed by Softc. In this way, the expected results can be calculated exactly a priori, and any deviations from these results indicate problems with the correlator.

The Softc Monte Carlo can simulate data in two ways. The first is an engineering mode where data can be generated with user selected delays, delay rates, fractional sample offsets, etc. This mode was very useful in the initial stages of debugging, as the implied geometric models were quite simple and covered a much greater parameter space than could be achieved by Earth-based station models. For example, data can be generated having a constant geometric fringe rate many times that possible for any Earth-based experiment; Softc’s performance under these extreme conditions is a good check that fringe-frequency related calculations are done correctly.

The second Monte Carlo mode simulates data using the correlator model. Correlating this simulated data with Softc using the same model should result in no residual delays or phases, and tests Softc in its usual processing mode. The power of this type of test was confirmed when data were simulated using the Block I correlator model for an old experiment. When the Block I processed the simulated data, the residual delay was not zero, but a constant 1-sample delay. In other words, it appears the Block I had always reported delays with a constant 1-sample delay error, and this problem was never found throughout the life of the correlator, but was found immediately with this Monte Carlo test. Softc has passed a large number of extensive Monte Carlo tests, and this, combined with the fact that few calculational approximations are made, gives great confidence that any remaining processing errors are either insignificantly small or easily corrected.

Other tools were also created to find errors early in Softc’s development. Because Softc was originally created to correlate 1 and 2-bit sampled data, the core processing routines perform extensive bit-level manipulations. Several test driver programs were developed for each bit-manipulation routine to check its function. Although these drivers are not part of the run-time portion of Softc, they should be considered part of the code package in the same way the Monte Carlo is part of Softc. These programs were designed to test the bit-manipulation routines under the most extreme conditions, and a significant effort went into trying to find processing errors in the core routines. The results of these tests were that the core routines, which perform the bulk of the processing, could be considered essentially bug-free. This made full-code debugging much easier because when a strange problem was seen in the results, many of the most perverse explanations one might imagine could be dropped from consideration.

In full code testing we found the unresolved errors to be dominated by modeling errors. The Monte Carlo cannot detect such problems because the same bad model both generates and correlates the data, or in other words, Softc cannot assess what is or is not a realistic model. For example, the first significant problem found turned out to be a sign error in the troposphere model. The Monte Carlo did not detect this (and could not possibly have done so), so only full code testing of real data could find these types of errors.

5. Future Directions at JPL

We recently obtained a new 18-CPU Beowulf computer and are currently porting Softc, Fit (our post-correlation software), and Modest (our parameter estimation software) onto this machine. We plan to interface this to two Mark 5 recorders by Jan 2004 and this will be JPL’s VLBI correlator. Work is in progress to update Fit and to add additional Softc capabilities so we should have a clean, modern software system in early 2004. Timing tests on this system show Softc can process 8 lags of 10 MHz sampled real USB single-bit data in real time, and that the processing time is roughly linear with sampling rates from 1 to 100 MHz.

We are canceling the development of our 4-station hardware correlator, which is now essentially complete. There is nothing wrong with this correlator other than it is a hardware correlator with all its intrinsic disadvantages. Walking away from our hardware correlator now puts us on a path with a future and will likely save significant money. Because the economics of this decision are probably common to other institutions, we may not see another 4-station hardware correlator being developed anywhere. The economics may also favor replacing larger correlators even now, but the community probably needs to go up the software correlator learning curve beginning with the smaller systems.

Work is under way to obtain an open software license for Softc so that others can benefit from this program. Softc and its algorithms are documented and that report should be publicly available very soon.

6. Summary

Softc was created to be as accurate as possible, capable of processing essentially any VLBI data, pass strong debugging tests, have a simple user interface, have no platform dependencies, and be written modularly in the most common programming language. It has been used operationally for spacecraft navigation for over 2 years and will be JPL’s Mark 5 correlator next year.

Bibliography

1

See Whitney, R., “Mark 5 Disk-Based Gbps VLBI Data System,” MIT Haystack Observatory, http://web.haystack.mit.edu/mark5/software.html for more on the tape vs. disk issue.

2

Lowe, S., “Softc: a Software VLBI Correlator,” JPL Report, in press.

Miriad

.. _astronomy-software-miriad:

Aim:data-reduction, image-analysis and publication-quality image displays,适用于连续谱和谱线。

极化

线极化

对于线极化,当收信天线的极化方向与线极化方向一致(电场方向)时,感应出的信号最大(电磁波在极化方向上投影最大);随着收信天线的极化方向与线极化方向偏离越来越多时,感应出的信号越小(投影不断减小);当收信天线的极化方向与线极化方向正交(磁场方向)时,感应出的信号为零(投影为零)。线极化方式对天线的方向要求较高。当然在实际条件下,电磁波传播途中遇到反射折射,会引起极化方向偏转,有时一个信号既可以被水平天线接收,也可以被垂直天线接收,但无论如何,天线的极化方向常常是需要考虑的重要问题。

圆极化

对于圆极化,无论收信天线的极化方向如何,感应出的信号都是相同的,不会有什么差别(电磁波在任何方向上的投影都是一样的)。所以,采用圆极化方式,使得系统对天线的方位(这里的方位是天线的方位,和前面所提到的方向系统的方位是不同的)敏感性降低。因而,大多数场合都采用了圆极化方式。圆极化天线如C326003B。

比喻

打个形象的比喻,线极化类似弯曲在地面上爬行的蛇,圆极化类似蛇绕在木棍上绕行。再打个比喻,你拿一根绳子,上下摆,绳子传递的波就是线极化形式的;不断地画圆,传递的波就是圆极化的。

circular polarization 对于transverse electromagnetic wave来说是E plane和H plane之间存在90度的phase difference。从传播方向来看,E 和H的和向量延圆形转动。linear polarization 是E和H的和向量成一个直线,可以为任意角度。从axial ratio来说,当最大的axis和最小axis之比为1或者0dB时是CP。当axial ratio 为 无穷大是为LP。CP antenna可以接收发射任意polarization的signal,而LP antenna只能有一个角度的signal。所以类似于手机用的天线,当天线周围环境会比较复杂的时候适合使用CP,这样周围环境引起的reflection所导致的polarization的变化对antenna 功能的影响会降到最低。而LP antenna会有更好的directivity,这对于定向的信号传播会更好。

LaTeX排版流程

在使用LaTeX进行排版时,从输入文本到最后在打印机上得到输出结果,通常需要经过下面的几个步骤。

编辑

用编辑器编写文稿(源文件),同时插入排版命令。需要注意的是,源文件必须是纯文本格式的,并且通常以.tex作为其扩展名(如hello.tex)。在Linux下建议使用XEmacs或者VIM编辑器,它们都能够识别LaTeX语法并且可以高亮显示LaTeX命令中的关键字。

编译

生成的LaTeX源文件中如果没有语法错误,那么就可以使用latex命令进行编译,生成DVI文件:

[leo@localhost latex]$ latex hello.tex

在处理过程中LaTeX会显示页号以及可能会有的错误和警告信息,如果在该过程中出现错误,则表明源文件中的某些排版命令有误,此时应该重新对源文件进行修改。当LaTeX成功结束这一处理过程后,将生成一个名为hello.dvi的文件,该文件是与设备无关的,它由格式化后的文本以及所需要的字体信息组成,但是与要使用的打印机的特征无关,该文件通常也称为元文件(metafile)。

查看

在正式打印输出或者照排制版之前,可以先在计算机屏幕上显示DVI文件,察看文件内容或者排版结果是否合乎要求,如果有不满意之外,则应重新对LaTeX源文件进行修改。在Linux下有许多软件可以用来查看DVI文件,其中最常用的是X-Window环境下的xdvi,下面的命令可以用来查看hello.dvi: [leo@localhost latex]$ xdvi hello.dvi 由于DVI文件是与设备无关的,因而用xdvi在屏幕上看到的结果是不会受到输出设备、操作系统、硬件环境等因素影响的。

打印

DVI元文件中的信息最终要被转化成可以在特定打印机上输出的形式,该过程是由一个称为打印驱动程序来完成的,它是与具体打印机相关的。例如,在Linux下可以用下面的命令将hello.dvi送到惠普激光打印机上打印:

[leo@localhost latex]$ dvihp hello.dvi

输出

在很多场合下,使用latex得到的DVI文件并不总是需要打印出来,而是要转化成更加便于阅读的格式,如PDF(Portable Document Format)或者PS(PostScript),LaTeX系统提供了相应的工具在这些格式之间进行转换。要将hello.dvi转化成hello.pdf和hello.ps,可以分别使用如下的命令:

[leo@localhost latex]$ dvipdf hello.dvi

[leo@localhost latex]$ dvips hello.dvi -o

帮助信息:

可以输入help来查看分类信息,或者help topic来查看每个topic的,或者使用lookfor来搜索,这个比较宽松,而help命令只能搜索出那些关键词完全匹配的结果。

演示系统:

我们可以输入demo来查看相应的演示模块。

挂载

1
$ mount -t vboxsf local_dir virtualbox_dir

Troubleshooting

安装增强功能的时候,未能加载虚拟光盘

通常第一次安装没有问题,但是如果系统升级以后,再重新安装会出现问题,此时可以进入系统看一下以前安装的时候,光盘是不是没有退出,点击退出,重新尝试一下,即可解决。

VBoxClient: the VirtualBox kernel service is not running. Exiting

1
please install libelf-dev, libelf-devel or elfutils-libelf-devel

This system is currently not set up to build kernel modules.

在安装增强功能时,也可能会出现依赖包没有安装的情况,具体报错如下:解决方法为安装他所提示的包

1
2
3
4
# CentOS
$ yum install kernel-devel-CURRENT_KERNEL #(具体替换代码所显示的包版本)
# Ubuntu
$ apt install linux-source

VNCViewer远程桌面按d后最小化桌面

使用VNCViewer登录了ubuntu以后,发现每次按下d键时都会隐藏所有的窗口,后来看了一下,是因为Ubuntu内置的默认有个快捷键shortcut是d。如图示:

即Hide all normal windows的快捷键为D,只需要改成你比较不常用的,或者诸如ALT+D等等即可解决问题。