Question

I have multiple input files from which I produce mean values.
I want to combine these mean values into a single array with them all in. Here is my code,

#! /usr/bin/env python
#peice of code to find the information from a star catalog for the brightest star from each indiviual CCD

import os, sys, glob, pyfits, numpy

data1='/home/desar2.cosmology.illinois.edu+7443/DESFiles/desardata/OPS/red/20130321211637_20130106/red/DECam_00166306/DECam_00166306_01_star_catalog.fits'
a=pyfits.getdata(data1).MAG_AUTO
i=numpy.mean(a)
print "mean mag=", q

s=pyfits.getdata(data1).X2WIN_IMAGE
j= numpy.mean(s)

f=pyfits.getdata(data1).Y2WIN_IMAGE
print numpy.mean(f)
z=numpy.mean(f)
print z

g=pyfits.getdata(data1).XYWIN_IMAGE
w= numpy.mean(g)

print '---done---'

How do I make an array with j, i, z and w in?

Was it helpful?

Solution

myArray = [j,i,z,w]

This makes a list, which is the python type most similar to an array.

numpy also has its own built-in array, which is going to be faster for numpy's math operations but a bit less versatile.

myArray = numpy.array([j,i,z,w])

Note that the argument is actually a list!

OTHER TIPS

a = [j,i,z,w]

An array with j, i, z and w in it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top