<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def energy_capture(self, stachans='all', size=(10, 7), show=False):
 """ Calculate the average percentage energy capture for this subspace. :return: Percentage energy capture :rtype: float """

        if show:
            return subspace_fc_plot(detector=self, stachans=stachans,
                                    size=size, show=show)
        percent_capture = 0
        if np.isinf(self.dimension):
            return 100
        for channel in self.sigma:
            fc = np.sum(channel[0:self.dimension]) / np.sum(channel)
            percent_capture += fc
        else:
            return 100 * (percent_capture / len(self.sigma))