<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_data(self, data, invsigma=None):
 """Set the data to be modeled. Returns *self*. """

        self.data = np.array(data, dtype=np.float, ndmin=1)

        if invsigma is None:
            self.invsigma = np.ones(self.data.shape)
        else:
            i = np.array(invsigma, dtype=np.float)
            self.invsigma = np.broadcast_arrays(self.data, i)[1] # allow scalar invsigma

        if self.invsigma.shape != self.data.shape:
            raise ValueError('data values and inverse-sigma values must have same shape')

        return self