astropy

Missing “six” module for astropy after using cx_freeze/py2exe

空扰寡人 提交于 2020-01-15 07:35:30
问题 I was trying to convert program written in python 3 to .exe using cx_freeze and py2exe. But after converting and running program i get the following error: Traceback (most recent call last): File "astroConverter.py", line 8, in <module> File "C:\Users\Konrad\PycharmProjects\astroConverter\mainwindow.py", line 2, in <module> from widgets.widgets import MainMenu, Toolbar, TextField File "C:\Users\Konrad\PycharmProjects\astroConverter\widgets\widgets.py", line 1, in <module> from widgets.menus

蟒周刊-401-Python 2.7 今天正式退休

怎甘沉沦 提交于 2020-01-06 16:58:24
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 原文: PyCoder's Weekly - Issue #401 200101 Zoom.Quiet (大妈) 用时 42 分钟 完成快译 200101 Zoom.Quiet (大妈) 用时 17 分钟 完成格式转抄. Python 2.7 Retires Today PYTHONCLOCK.ORG Python 2.7 will not be maintained past Jan 1st, 2020. So long Python 2, and thank you for your years of faithful service. Python 3, your time is now! ( 是也乎: 当然, 海量 Py2.7 兼容代码, 将继续在非官方支持下良好运行到永远... ) 对 Python之禅 的冥想 MOSHE ZADKA “The Zen of Python is not ‘the rules of Python’ or ‘guidelines of Python’. It is full of contradiction and allusion. It is not intended to be followed: it is intended to be meditated

How to speed up a python 2 program with multiple nested for-loops

房东的猫 提交于 2020-01-06 07:55:31
问题 This code has multiple for-loops and the lists I read in have 999 points each. I want to iterate this up to 10,000 times. However, even iterating it only 2 times takes nearly 10 minutes. Even though I'm posting this specific code, I think an answer to my question can help others run their codes with a lot of data more quickly. Any of your advice is appreciated. Thanks a lot. What this code does: Basically, I'm reading in arrays from textfile as lists. Each list (e.g. x1,y1,z1... etc) has 999

How to Create .fits file from numpy array

泪湿孤枕 提交于 2020-01-06 07:01:08
问题 I am currently trying to convert a .cr2 into .fits file. I am currently unable to create .fits as any file I create doesn't open or work because of the wrong shape of fits. I have tried using the solution Write 3d Numpy array to FITS file with Astropy but, still, it doesn't work. import numpy as np from astropy.io import fits im = imageio.imread(r'E:\FYP\cr.cr2', format="RAW-FI") a = np.array(im) print (a.shape) hdu = fits.PrimaryHDU(a) hdulist = fits.HDUList([hdu]) hdulist.writeto(r'E:\FYPcr

OSError 24 (Too many open files) when reading bunch of FITS with astropy.io

有些话、适合烂在心里 提交于 2020-01-03 11:51:28
问题 I’m trying to load into memory a few 2 000 FITS using astropy.io.fits : def readfits(filename): with fits.open(filename) as ft: # the fits contain a single HDU data = ft[0].data return data data_sci = [] for i in range(2000): data_sci.append(readfits("filename_{}.fits".format(i))) However, when reaching the 1015th file, OSError: [Errno 24] Too many open files is raised. I have the same issue with: def readfits(filename): ft = fits.open(filename) as ft: data = ft[0].data ft.close() return data

Copy header into new file astropy

你。 提交于 2019-12-25 18:27:14
问题 I have this script that makes a file with multiple extensions, but I would like to add headers from the old files to the extensions. new_hdul = fits.HDUList() new_hdul.append(fits.PrimaryHDU(header=headermain)) new_hdul.append(fits.ImageHDU(nod1, header=header1, name='Chop1')) new_hdul.append(fits.ImageHDU(nod2, header=header2, name='Chop2')) new_hdul.append(fits.ImageHDU(diff1, name='Dif')) Now I have tried: headermain = fits.getheader(file,0) and headermain = fits.open(file).header.copy()

ValueError when using pip or easy_install to install a package into winpython

我只是一个虾纸丫 提交于 2019-12-25 04:43:00
问题 Currently doing a science course and using python to do calculations and plotting. The Uni uses winpython 2.7.5.3 This is the version I've installed as it has all the standard packages I need. I'm using windows 7 64bit However my course has started diverging and I need to install additional packages, specifically Astropy. Initially I had a vcvarsall.bat error, this was fixed by installing Visual C++ 2008 express. After this both the included version 1.4.1 of pip and easy_install-2.7 find the

Replacing masked values (--) with a Null or None value using fiil_value from ma numpy in Python

一个人想着一个人 提交于 2019-12-24 12:44:11
问题 Is there a way to replace a masked value in a numpy masked array as a null or None value? This is what I have tried but does not work. for stars in range(length_masterlist_final): .... star = customSimbad.query_object(star_names[stars]) #obtain stellar info. photometry_dataframe.iloc[stars,0] = star_IDs[stars] photometry_dataframe.iloc[stars,1] = star_names[stars] photometry_dataframe.iloc[stars,2] = star['FLUX_U'][0] #Replace "--" masked values with a Null (i.e., '') value. photometry

Python: Compiling astropy with pyinstaller

拥有回忆 提交于 2019-12-24 11:44:26
问题 Currently I'm trying to compile a python application with pyinstaller for distribution. Unfortunately, the compiled version doesn't run, seemingly because of one of astropy's dependencies: six. Astropy encounters an import error on startup although I've even tried adding six to 'hidden imports' in the application's specs-file. Strangely however, during compilation pyinstaller notes that my hidden import 'six' has been found otherwise (this is also the only time six is mentioned) but still it

How to index observable coordinates in an astropy Table

不打扰是莪最后的温柔 提交于 2019-12-24 00:58:29
问题 I asked this question (How to sort through a list of observable coordinates?) yesterday about sorting a list of coordinates to remove certain values below a threshold, I got a great answer from @MSeifert but I have a table in which these coordinate values are matched up with other properties of the targets (e.g. apparent magnitude and Alt/Az coordinates), so what I am asking for now is a way to do this masking technique in an astropy.table rather than an astropy.coordinates.SkyCoord list from