<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_gradient_x(shape, px):
 """Calculate the gradient in the x direction to the line at px The y gradient operator is a block diagonal matrix, where each block is the size of the image width. The matrix itself is made up of (img_height x img_height) blocks, most of which are all zeros. """

    import scipy.sparse

    height, width = shape
    size = height * width

    # Set the diagonal to -1, except for the value at the peak, which is zero
    c = -np.ones((width,))
    c[px] = 0
    # Set the pixels leading up to the peak from the left
    r = np.zeros(c.shape, dtype=c.dtype)
    r[:px] = 1
    # Set the pixels leading up to the peak from the right
    l = np.zeros(c.shape, dtype=c.dtype)
    l[px:] = 1
    # Make a block for a single row in the image
    block = scipy.sparse.diags([l, c, r], [-1, 0,1], shape=(width,width))
    # Use the same block for each row
    op = scipy.sparse.block_diag([block for n in range(height)])
    return op