<commit_before>/*****************************************************************************
 *  Calculate the Kolmogorov structure function (at given order) of discrete
 *  time series data fron a 4-column input file.  Write a 4-column output
 *  file containing timescales, SF denominator, SF numerator, uncertainty.
 *
 *  The first command-line argument is the input data file.
 *
 *
 *  INPUT FILE FORMAT:
 *
 *  The input file has four columns:
 *
 *      t       = time of observation (temperal bin centroid)
 *      dt      = width of the temporal bin (or time uncertainty)  
 *      z       = signal or count-rate during this time bin
 *      dz      = uncertainty in the signal or count-rate
 *
 *
 *  OUTPUT FILE FORMAT:
 *
 *  The output file has four columns:
 *
 *      tau     = timescale of SF evaluation                    
 *      W       = a weight or normalisation denominator in the SF
 *      W S     = numerator in the structure function at tau
 *      W dS    = uncertainty propagated to the product (W S)
 *
 *  Thus the order-n structure function at timescale tau, and its uncertainty
 *  are:
 *
 *      S_n(tau)  = (W S) / W   =  (column 3) / (column 2)
 *      dS_n(tau) = (W dS) / W  = (column 4) / (column 2)
 *
 *  The code writes the denominator "W" as a separate column as a precaution.
 *  With temporally patchy data, there are sometimes circumstances when W=0 at
 *  some timescale tau.  Keeping "W" distinct enables an informed user to
 *  discard those rows from the output file.
 *
 *  The sequence of tau values is the union of a linearly spaced sequence
 *  (tmin<=tau<=tmax) and a logarithmically spaced sequence in the same domain.
 *  To increase or decrease the resolution of this output grid, vary the "try"
 *  command-line parameter.
 *
 *
 *  EXAMPLE:
 *
 *  ./patchsf signal.dat start=1. end=20. n=2 tmin=10. tmax=1.e3 ^results.dat
 *
 *
 *  COMMAND-LINE PARAMETERS & OPTIONS:
 *
 *	start	= use input data after this time
 *	end	= use input data before this time
 *	-logx	flag: take logarithm of independent variable (time)
 *	-logy	flag: take logarithm of dependent variable (signal)
 *
 * 	n	= order of the structure function
 *	try	= number of tau grid points -1
 *	tmin	= shortest time-scale (tmin <= tau)
 *	tmax	= longest time-scale (tau <= tmax)
 *
 *  Alternatively, calculate a Leahy normalised power spectrum.
 *
 *	-pds	flag: compute power density spectrum, not structure function
 *
 *  Results are written into a file named after the host machine + ".dat".
 *  An alternative output file can be named as:
 *
 *	^blah.dat	send output to "blah.dat" 
 *
 *
 *  COMPILATION:
 *
 *  	gcc -lm -lgsl -lgslcblas patchsf.c -o patchsf
 *
 *
 *
 *  HISTORY:
 *
 *	Written by <NAME> (2011,2012).
 *	Tidying by <NAME> (20160306).
 *
 *	Cite reference:
 *
 *	"Long-term X-ray variability of Swift J1644+57"
 *	 <NAME>,  <NAME>,  <NAME>,  <NAME>, 
 *	 2012, Monthly Notices Royal Astronomical Society 422, 1625-1639.
 *	 http://arxiv.org/abs/1201.5210
 *	 http://dx.doi.org/10.1111/j.1365-2966.2012.20739.x<commit_msg>comments about compilation<commit_after>/*****************************************************************************
 *  Calculate the Kolmogorov structure function (at given order) of discrete
 *  time series data fron a 4-column input file.  Write a 4-column output
 *  file containing timescales, SF denominator, SF numerator, uncertainty.
 *
 *  The first command-line argument is the input data file.
 *
 *
 *  INPUT FILE FORMAT:
 *
 *  The input file has four columns:
 *
 *      t       = time of observation (temperal bin centroid)
 *      dt      = width of the temporal bin (or time uncertainty)  
 *      z       = signal or count-rate during this time bin
 *      dz      = uncertainty in the signal or count-rate
 *
 *
 *  OUTPUT FILE FORMAT:
 *
 *  The output file has four columns:
 *
 *      tau     = timescale of SF evaluation                    
 *      W       = a weight or normalisation denominator in the SF
 *      W S     = numerator in the structure function at tau
 *      W dS    = uncertainty propagated to the product (W S)
 *
 *  Thus the order-n structure function at timescale tau, and its uncertainty
 *  are:
 *
 *      S_n(tau)  = (W S) / W   =  (column 3) / (column 2)
 *      dS_n(tau) = (W dS) / W  = (column 4) / (column 2)
 *
 *  The code writes the denominator "W" as a separate column as a precaution.
 *  With temporally patchy data, there are sometimes circumstances when W=0 at
 *  some timescale tau.  Keeping "W" distinct enables an informed user to
 *  discard those rows from the output file.
 *
 *  The sequence of tau values is the union of a linearly spaced sequence
 *  (tmin<=tau<=tmax) and a logarithmically spaced sequence in the same domain.
 *  To increase or decrease the resolution of this output grid, vary the "try"
 *  command-line parameter.
 *
 *
 *  EXAMPLE:
 *
 *  ./patchsf signal.dat start=1. end=20. n=2 tmin=10. tmax=1.e3 ^results.dat
 *
 *
 *  COMMAND-LINE PARAMETERS & OPTIONS:
 *
 *	start	= use input data after this time
 *	end	= use input data before this time
 *	-logx	flag: take logarithm of independent variable (time)
 *	-logy	flag: take logarithm of dependent variable (signal)
 *
 * 	n	= order of the structure function
 *	try	= number of tau grid points -1
 *	tmin	= shortest time-scale (tmin <= tau)
 *	tmax	= longest time-scale (tau <= tmax)
 *
 *  Alternatively, calculate a Leahy normalised power spectrum.
 *
 *	-pds	flag: compute power density spectrum, not structure function
 *
 *  Results are written into a file named after the host machine + ".dat".
 *  An alternative output file can be named as:
 *
 *	^blah.dat	send output to "blah.dat" 
 *
 *
 *  COMPILATION:
 *
 *  	gcc -lm -lgsl -lgslcblas patchsf.c -o patchsf
 *
 * This code depends on the installation of Gnu Scientific Library (GSL):
 * 	http://www.gnu.org/software/gsl/
 *
 *
 *  HISTORY:
 *
 *	Written by <NAME> (2011,2012).
 *	Tidying by <NAME> (20160306).
 *
 *	Cite reference:
 *
 *	"Long-term X-ray variability of Swift J1644+57"
 *	 <NAME>,  <NAME>,  <NAME>,  <NAME>, 
 *	 2012, Monthly Notices Royal Astronomical Society 422, 1625-1639.
 *	 http://arxiv.org/abs/1201.5210
 *	 http://dx.doi.org/10.1111/j.1365-2966.2012.20739.x
{'fraction_non_alphanumeric': 0.11932907348242812, 'fraction_numerical': 0.0268370607028754, 'mean_word_length': 2.848186846957591, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1935136', 'n_tokens_mistral': 2147, 'n_tokens_neox': 1934, 'n_words': 761}