data_from_txt¶
- pySurf.data2D.data_from_txt(filename, x=None, y=None, xrange=None, yrange=None, matrix=False, addaxis=False, center=None, skip_header=None, delimiter=' ', strip=False, **kwargs)¶
Read matrix from text file. Return data,x,y.
handle addaxis, center and strip nan, on top of all np.genfromtxt options. This function shouldn’t be called directly, there are smarter ways of doing it using read_data and readers,
however, this is a quick way to get data from text if you don’t know what I am talking about.
- center: is the position of the center of the image in final coordinates (changed on 2016/08/10, it was ‘(before any scaling or rotation) in absolute coordinates.’) If None coordinates are left unchanged.
Set to (0,0) to center the coordinate system to the data.
- addaxis: (if matrix is set) can be set to read values for axis in first row and column
(e.g. if points were saved with default addaxis=True in save_data.
- strip (renamed from autocrop): remove frame of nans (external rows and columns made all of nans),
note it is done before centering. To include all data in centering, crop data at a second time with remove_nan_frame
- 2020/07/10 Added kwargs even if they are not used to suppress error if unknown arguments
are passed, that can be convenient when kwargs for multiple subfunctions are passed to the calling code. This way, kwargs that are meant for another function are tollerated, even if it is suboptimal, a better filtering of kwargs should be done. For example, makes it fail when called by instrument_reader.read_data with header=True, because even if the function doesn’t expect a header keyword, the caller routine doesn’t detect the error. Solution is to make the calling routine check for undefined values?