Add a derived quantify modifier.

        Parameters
        ----------
        derived_quantity : str
            name of the derived quantity to be added

        func : callable
            function to calculate the derived quantity
            the number of arguments should equal number of following `quantities`

        quantities : list of str
            quantities to pass to the callable

def add_derived_quantity(self, derived_quantity, func, *quantities):
        """
        Add a derived quantify modifier.

        Parameters
        ----------
        derived_quantity : str
            name of the derived quantity to be added

        func : callable
            function to calculate the derived quantity
            the number of arguments should equal number of following `quantities`

        quantities : list of str
            quantities to pass to the callable
        """
        if derived_quantity in self._quantity_modifiers:
            raise ValueError('quantity name `{}` already exists'.format(derived_quantity))

        if set(quantities).issubset(self._native_quantities):
            new_modifier = (func,) + quantities

        else:
            functions = []
            quantities_needed = []
            quantity_count = []
            for q in quantities:
                modifier = self.get_normalized_quantity_modifier(q)
                functions.append(modifier[0])
                quantities_needed.extend(modifier[1:])
                quantity_count.append(len(modifier)-1)

            def _new_func(*x):
                assert len(x) == sum(quantity_count)
                count_current = 0
                new_args = []
                for func_this, count in zip(functions, quantity_count):
                    new_args.append(func_this(*x[count_current:count_current+count]))
                    count_current += count
                return func(*new_args)

            new_modifier = (_new_func,) + tuple(quantities_needed)

        self.add_quantity_modifier(derived_quantity, new_modifier)