def normintens_to_countrate(ni_map, star_photrate, collecting_area,
                            coron_thrupt_peakpixel, optloss = 0.5,
                            qe = 0.9, ifsloss = 1.0):
    """
    Convert a normalized intensity array to an array of photoelectron count 
    rates, based on parameters for stellar irradiance, telescope collecting 
    area, coronagragh mask throughput, optical loss factor, and detector 
    quantum efficiency.
    
    Parameters
    ----------
    ni_map : numpy.ndarray
        Input array of normalized intensity values, normalized to the detector
        pixel integrated peak of an unocculted PSF.
    star_photrate : astropy.units.quantity.Quantity, of physical dimensions 
        energy / time / area. This is the bandpass-integrated irradiance of 
        the target star; suggested units are photons / second / meter^2
    collecting_area : astropy.units.quantity.Quantity, of physical dimensions 
        area. This is the collecting area of the obscured telelescope aperture.
    coron_thrupt_peakpixel: numpy.float
        Throughput from telescope aperture to the detector-pixel-inegrated peak 
        of an unocculted PSF.
    optloss : numpy.float
        Cumulative attenuation due to mirror reflections and transmissive optics
    qe : numpy.float
        Detector quantum efficiency; can also include losses due to readout 
        efficiencies and cosmic rays
    ifsloss : numpy.float
        signal attenuation factor due to re-imaging onto spectrograph detector;
        for no IFS leave at the default value of 1.0.
        
    Returns
    -------
    countrate_map : numpy.ndarray of astropy.units.quantity.Quantity
        Photoelectron count rate map, units photons / sec
    """
    countrate_map = (ni_map * star_photrate * collecting_area * 
                     coron_thrupt_peakpixel * optloss * qe * ifsloss)
    return countrate_map