human
I am working on the file "Sessions/Session08/Day3/miniBroker.ipynb".
The first task is:
Problem 2) Data Preparation
While we could create a database table that includes every single photometric measurement made by LSST, this ~37 trillion row db would be enormous without providing a lot of added value beyond the raw flux measurements [while this table is necessary, alternative tables may provide more useful information]. Furthermore, extracting individual light curves from such a database will be slow. Instead, we are going to develop summary statistics for every source which will make it easier to select individual sources and develop classifiers to identify objects of interest.  
Below we will create a new class, Variable, which will inherit the properties of the Source class. The Variable class includes several additional methods so we can (eventually) store summary statistics in a database table. In the interest of time, we limit the summary statistics to a relatively small list all of which have been shown to be useful for classification (see Richards et al. 2011 for further details). The statistics that we include (for now) are: 

Std -- the standard deviation of the flux measurements 
Amp -- the amplitude of flux deviations
MAD -- the median absolute deviation of the flux measurements
beyond1std -- the fraction of flux measurements beyond 1 standard deviation
skew -- the skewness of a data set
the mean $g' - r'$, $r' - i'$, and $i' - z'$ color

Note - while the magnitude system used in astronomy is stupid, and as a reminder: 
$$\mathrm{mag} = -2.5\log{\mathrm{flux}} + C$$
where $C$ is a constant. Comparisons of $\Delta \mathrm{flux}$ for different stars encodes both the brightness variations and the distance to the star in question. $\Delta \mathrm{mag}$, on the other hand, normalizes the brightness variations to provide a more apples to apples comparison (however the use of a logarithmic basis results in a biased apples to apples comparison).
All of this is a long way of saying - when you calculate the Std, Amp, and MAD below you want to normalize these measurements by dividing each by...
Can you write Python program for it?
assistant
#Here is Python program to calculate the Std, Amp, and MAD below you want to normalize these measurements by dividing each by.

class Variable( # complete
    '''Variable subclass of fake sources'''
    
    def __init__( # complete
        # complete
    
    def filter_flux(self):
        '''Store individual passband fluxes as object attributes'''
        
        for filt in self._filters:
            filt_obs = np.where(self._lc_df['pb'] == filt)
            setattr(self, '_{0}_time'.format(filt), 
                    self._lc_df['t'].iloc[filt_obs])
            setattr(self, '_{0}_flux'.format(filt), 
                    self._lc_df['flux'].iloc[filt_obs])
            setattr(self, '_{0}_flux_unc'.format(filt), 
                    self._lc_df['dflux'].iloc[filt_obs])

    def weighted_mean_flux(self):
        '''Measure (SNR weighted) mean flux in griz'''

        if not hasattr(self, '_g_flux'):
            self.filter_flux()
            
        weighted_mean = lambda flux, dflux: np.sum(flux*(flux/dflux)**2)/np.sum((flux/dflux)**2)
        
        for filt in self._filters:
            filt_flux = getattr(self, '_{0}_flux'.format(filt))
            filt_dflux = getattr(self, '_{0}_flux_unc'.format(filt))
            setattr(self, '_{0}_mean'.format(filt), 
                    weighted_mean(filt_flux, filt_dflux))
        
    def normalized_flux_std(self):
        # complete
        # complete
        # complete
        # complete

    def normalized_amplitude(self):
        # complete
        # complete
        # complete
        # complete
        
    def normalized_MAD(self):
        # complete
        # complete
        # complete
        # complete
        
    def beyond_1std(self):
        # complete
        # complete
        # complete
        # complete
    
    def skew(self):
        # complete
        # complete
        # complete
        # complete
        
    def mean_colors(self):
        # complete
        # complete
        # complete
        # complete