rfinn / halphagui

development of gui interface for H-alpha narrowband imaging
GNU General Public License v3.0
0 stars 0 forks source link

Problem with plot of galaxies WRT filter transmission curve #94

Closed rfinn closed 1 year ago

rfinn commented 1 year ago

Describe the bug The histogram of galaxies WRT to the filter transmission is not consistent. This is an issue with filter_transmission.py when it creates galaxies_in_filter.png

def get_trans_correction(self, redshift,outfile=None):
        # return ratio of max filter transmission
        # to transmission at that wavelength
        # wave can be a single value or an array
        wave = (redshift+1)*wave_halpha
        transmission, flag = self.get_transmission(wave)
        #self.test = transmission
        correction = np.zeros(len(transmission),'f')
        correction = self.maxtrans/transmission
        plt.figure()
        plt.plot(self.wave, self.trans/10,'k-')
        plt.hist(wave, bins=5)
        plt.xlim((self.minz_trans10+1)*wave_halpha-50,(self.maxz_trans10+1)*wave_halpha+50)
        plt.xlabel('Wavelength (Angstrom)')
        plt.ylabel('Transmission %/10')
        titlestring = 'Halpha Filter = {}'.format(self.hafilter)
        plt.title(titlestring)
        #plt.show()
        if outfile is not None:
            plt.savefig(outfile)
        else:
            plt.savefig('galaxies_in_filter.png')
        return correction

To Reproduce Sometimes galaxies are missing altogether

missing

sometimes histogram bins arereally narrow

sometimes bins are fatter

Expected behavior I think I just need to set the bins to

bins = np.linspace(minlamba,maxlamba,20) 

or something like that.