(“绘制夜空全天地图”,)

nsb的Python项目详细描述


NSB(夜空背景)


绘制与Krisciunas月光亮度模型相对应的夜空全天图,以及从Gaia公共数据发布目录获得的恒星数据。结果是一个二维像素阵列,每个天空位置都有物理亮度值。

或者估计给定光源在时间范围内的亮度。GAIA数据将通过查询自动下载到相应的ESA服务器。用户刚刚决定要买多少。为了“按名称”调用源并存储它们的位置,nsb包含一个子包“mypycat”。因此需要一个没有提供的目录。只会创建一个虚拟文件,用户可以将任何源坐标添加到~/.nsb/mypycat.txt

用作命令行工具

python -m nsb [--OPTIONS] [--FLAGS]
python -m --help

--h --help prints this help message

--create CONFIGFILE
   writes a standard value configfile


OPTIONS:
(can all be set in config)

--use CONFIGFILE:
   use a dedicated (non standard) configfile
--t1 --time DATETIME:
   time and date for which the map should be drawn
   format: 2010/12/24 23:59:59
--t2 --time_end DATETIME:
   needed for plots over a timestamp like --trend and --maxnsb
   format: 2010/12/24 23:59:59
--o --output /OUTPUT/DIRECTORY/
   for saving results in different place than working directory
   filenames will be generated automatically
--s --size IMAGESIZE:
   set the output Imagesize in Pixels
--altaz ALT AZ:
   set the observation position in the sky manually (unit: degrees)
--q --source SOURCENAME:
   set the observation position automatically on a source by name
   i.e.: "crab", "moon"
--l --location LOCATION:
   The observers coordinates (Lon Lat) on earth and elevation (unit: degrees and meters)
   format: 16.5028 -23.27280 1800.0
--hp LEVEL:
   HealPix Level for the gaia catalog to be plotted
   Integer in range [1:12]
--g --gauss KERNELSIZE:
   Gaussian Kernel in pixel to smoothen the model images
   format: 1.5


FLAGS:
(to steer programs the behaviour)

--verbose
   Do verbose printouts
--mhz
   use the new and still EXPERIMENTAL model to output MHz instead of nLb
--skymap
   create the skymap and show it on screen
--savefits
   save the Sky-Brightness Map as *.fits file
--maxnsb VALUE
   creates a plot of nsb vs. gained observation time.
   data points are additionally printed to console with --verbose.
   (NEEDS a --time_end, typically more than a year to be not influenced by the Seasons)
   format: 100.0
--trend
   creates a time trend plot of nsb and source position over the given timespan
   (NEEDS a --time_end)
   Source, Sun and Moon Setting/Rising times are printed to console with --verbose

将其用作库

请参见以下示例:

创建allsky和视场地图,在屏幕上显示并将其保存为合适的

fromnsbimportconfigfromnsb.modelimportnsbModelfromnsb.mypycatimportmypycatfromnsb.gaiaimportGaiafromnsb.nsbtoolsimportmakeDateString,plotMapsimportephemimportmatplotlib.pyplotaspltimportastropy.io.fitsaspyfitscon=config.TheConfiguration()con.readStandardConfig()# or read a custom config# con.readConfig("my_config.cfg")#time_and_date = makeDateString("today now")time_and_date=ephem.Date("2019-01-26 21:29:07")mpc=mypycat()source=mpc.get("Crab Pulsar")gaiamap=Gaia(level=10)model=nsbModel(con,gaiamap,time_and_date,use_mhz=True)# draw what you wantmodel.drawAllSky(size=800)model.drawFOV_source(source=source,fov=5.0,size=1000)# model.drawFOV_altaz(alt=30, az=213, fov=5.0, size=42)# show the results on screenplotMaps(model.allskymap.data,'Allskymaps for %s'%(model.observer_source.date))plotMaps(model.fovmap.data,'FOV for %s'%(model.observer_source.date))plt.show()# save fits fileshdul=pyfits.HDUList([model.allskymap,model.fovmap])hdul.writeto("NSB_of_"+makeDateString(time_and_date)+"_.fits",'exception',True)

或者在一段时间内获取所有类型的值,如亮度、高度、方位角、相位等

fromnsbimportconfigfromnsb.modelimportnsbModelfromnsb.mypycatimportmypycatfromnsb.gaiaimportGaiafromnsb.nsbtoolsimportplotTimespanimportephemcon=config.TheConfiguration()con.readStandardConfig()time_and_date_1=ephem.Date("2019/05/10 12:00:00")time_and_date_2=time_and_date_1+1.0# plus one day (24h)mpc=mypycat()source=mpc.get("Eta Carinae")gaiamap=Gaia(level=7)model=nsbModel(con,gaiamap,time_and_date_1,time_and_date_2,threshold=400,timeresolution=15,verbose=False)model.setSource(source=source)model.calculateTimespan()# now these arrays are available and filledt=model.timestampsb=model.brightmp=model.moonphasemalt=model.moonaltsalt=model.sourcealtmaz=model.moonazsaz=model.sourceazsunalt=model.sunaltsunaz=model.sunazsep=model.separation# TODO: anything you like with these values# the plot from the --trend cmdline toolplotTimespan(model)

如果有问题,请随时与我联系:

马蒂亚斯.布埃切勒[在]法奥[点]德

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Android中的java Apache Velocity(“无法找到资源”)   在安卓 api 17中使用应用程序上下文膨胀视图时,java不能在安卓自定义toast的布局中使用material主题属性   java相当于Joda时间中的周中日   从我的应用程序中拍摄的java照片,保存在正确的文件夹中,但在图库中看不到   Java中无需分配返回值即可调用内存管理非void方法   java如何根据集合大小确定使用哪种方法   java有可能在ProjectReactor中有一个对多个订阅者提供独立背压支持的热发布服务器吗?   mysql在插入之前检查注册数据?JAVA   java如何防止注册后重定向到其他活动?   java如何仅当SWT视图在屏幕上滚动到时才加载它们?   java将类添加到Swing包结果是一个可见函数上的IllegaAccessError   如何按日期对查询结果进行排序(Jpa、Java集合)   多线程同步java中的持久性加载程序   JavaNIFI自定义orc处理器为类org提供NoClassDefFoundError。阿帕奇。hadoop。hdfs。分布式文件系统   java为什么我的for循环告诉我语法错误,插入“AssignmentOperator Expression”?   java在swing中点击按钮可以打开Jmenu吗?   lambda使用Java流将对象映射到多个对象   在OSX小牛上使用多个JDK的java   java检查上、下、数字、符号和空格