Nestak2 / GetingStarted2.May2016

First repository, Nestor
0 stars 0 forks source link

Revising the binning plot #1

Closed low-sky closed 8 years ago

low-sky commented 8 years ago

@Nestak2 -- The first cut looks good. I think we should change up the initial approach to the code a bit. Let's outline the code as follows. You will need to fill in the details.

def main():
    # This is the main routine.
    ListOfFiles = ['NGC1333_NH3_11_DR1.fits', 'NGC1333_NH3_22_DR1.fits', 'NGC1333_NH3_33_DR1.fits', 
   'NGC1333_C2S_DR1.fits',
   'NGC1333_HC5N_DR1.fits',
   'NGC1333_HC7N_21_20_DR1.fits', 'NGC1333_HC7N_22_21_DR1.fits']
    thisbin=5
    data_for_binning = fits.getdata('label_map_data.fits")
    labelmap = MakeLabelMap(data_for_binning) 
    # This takes in a 2D map and returns a 2D map where the image values are the bin to which a pixel belongs.
    for filename in ListOfFiles:
        cube = SpectralCube.read(filename)
        #Change to velocity axis and such here as well.  Then average all spectra with that bin label.
        average_spectrum, average_velocity = Averager(cube, labelmap, bin = thisbin)
        plt.plot(average_velocity, average_spectrum)