def align(time, time2, magnitude, magnitude2, error, error2):
    """Synchronizes the light-curves in the two different bands.

    Returns
    -------

    aligned_time
    aligned_magnitude
    aligned_magnitude2
    aligned_error
    aligned_error2

    """

    error = np.zeros(time.shape) if error is None else error
    error2 = np.zeros(time2.shape) if error2 is None else error2

    # this asume that the first series is the short one
    sserie = pd.DataFrame({"mag": magnitude, "error": error}, index=time)
    lserie = pd.DataFrame({"mag": magnitude2, "error": error2}, index=time2)

    # if the second serie is logest then revert
    if len(time) > len(time2):
        sserie, lserie = lserie, sserie

    # make the merge
    merged = sserie.join(lserie, how="inner", rsuffix='2')

    # recreate columns
    new_time = merged.index.values
    new_mag, new_mag2 = merged.mag.values, merged.mag2.values
    new_error, new_error2 = merged.error.values, merged.error2.values

    if len(time) > len(time2):
        new_mag, new_mag2 = new_mag2, new_mag
        new_error, new_error2 = new_error2, new_error

    return new_time, new_mag, new_mag2, new_error, new_error2
def align ( time , time2 , magnitude , magnitude2 , error , error2 ) : error = np . zeros ( time . shape ) if error is None else error error2 = np . zeros ( time2 . shape ) if error2 is None else error2 sserie = pd . DataFrame ( { "mag" : magnitude , "error" : error } , index = time ) lserie = pd . DataFrame ( { "mag" : magnitude2 , "error" : error2 } , index = time2 ) if len ( time ) > len ( time2 ) : sserie , lserie = lserie , sserie merged = sserie . join ( lserie , how = "inner" , rsuffix = '2' ) new_time = merged . index . values new_mag , new_mag2 = merged . mag . values , merged . mag2 . values new_error , new_error2 = merged . error . values , merged . error2 . values if len ( time ) > len ( time2 ) : new_mag , new_mag2 = new_mag2 , new_mag new_error , new_error2 = new_error2 , new_error return new_time , new_mag , new_mag2 , new_error , new_error2
Synchronizes the light-curves in the two different bands.

    Returns
    -------

    aligned_time
    aligned_magnitude
    aligned_magnitude2
    aligned_error
    aligned_error2