https://raw.githubusercontent.com/MatthewReid854/reliability/master/docs/images/logo.png

XCN_to_FNRN

class reliability.Convert_data.XCN_to_FNRN(X, C, N=None, censor_code=None, failure_code=None)

XCN_to_FNRN data format converter

Inputs: X - the failure or right_censored time. This must be an array or list. C - the censoring code for each X. This must be an array or list. Defaults are recognised from the lists shown below. N - the quantity for each X. This must be an array or list. Optional Input. If omitted all items are assumed to have quantity (N) of 1. censor_code - specify the censor code you have used if it does not appear in the defaults (see below). Optional input.

  • default censor codes that will be recognised (not case sensitive): R, ‘RC’, ‘RIGHT CENS’, ‘RIGHT CENSORED’, ‘C’, ‘CENSORED’, ‘CENS’, ‘S’, ‘SUSP’, ‘SUSPENSION’, ‘SUSPENDED’, ‘UF’, ‘UNFAILED’, ‘UNFAIL’, ‘NF’, ‘NO FAIL’, ‘NO FAILURE’, ‘NOT FAILED’, 1
failure_code - specify the failure code you have used if it does not appear in the defaults (see below). Optional Input.
  • default failure codes that will be recognised (not case sensitive): ‘F’, ‘FAIL’, ‘FAILED’, ‘FAILURE’, 0

Output: failures num_failures right_censored num_right_censored

Methods: print() - this will print a dataframe of the data in FNRN format to the console write_to_xlsx() - this will export the data in FNRN format to an xlsx file at the specified path.

Example usage: FNRN = XCN_to_FNRN(X=[1,2,3,7,8,9], C=[‘f’,’f’,’f’,’c’,’c’,’c’], N=[1,2,2,3,2,1]) print(FNRN.failures)

>>> [1 2 3]
print(FNRN.num_failures)
>>> [1 2 2]
print(FNRN.right_censored)
>>> [7 8 9]
print(FNRN.num_right_censored)
>>> [3 2 1]
FNRN.print()
>>> Data (FNRN format)
    failures  number of failures  right censored  number of right censored
           1                   1               7                         3
           2                   2               8                         2
           3                   2               9                         1
print()
write_to_xlsx(path, **kwargs)