for clarity of disclosure , and not by way of limitation , the detailed description of the invention is divided into the following subsections that describe or illustrate certain features , embodiments or applications of the present invention . in some embodiments , the present invention provides a system for detecting , recording and analyzing cardiac electrical activity data from a pregnant mother carrying a fetus . in some embodiments , a plurality of ecg sensors is used to record the cardiac electrical activity data . in some embodiments , ecg sensors , comprising electrodes that record cardiac electrical activity data are attached to the abdomen of the pregnant mother . in some embodiments , the ecg sensors are directly attached . in some embodiments , the ecg sensors are incorporated into an article , such as , for example , a belt , a patch , and the like , and the article is worn by , or placed on , the pregnant mother . the choice of ecg sensors is readily determined by one of ordinary skill in the art . factors influencing sensor choice include , but are not limited to , the sensitivity of the electrodes , the size of the electrodes , the weight of the electrodes , and the like . in some embodiments , the ecg sensors are wet - contact electrodes . in some embodiments , the ecg sensors are dry contact electrodes . in some embodiments , the arrangement of the ecg sensors provides a system for recording , detecting and analyzing fetal cardiac electrical activity data regardless of sensor position , fetal orientation , fetal movement , or gestational age . in some embodiments , the ecg sensors are attached , or positioned , on the abdomen of the pregnant mother in the configuration shown in fig1 . in some embodiments , the ecg sensors are divided into channels comprising a pair of ecg sensors , and cardiac electrical activity data is recorded simultaneously from the channels . in some embodiments , the channels output the acquired signal data , corresponding to the recorded cardiac electrical activity data . in some embodiments , at least one ecg sensor pair is used to obtain the acquired signal data . in some embodiments , the number of acquired signal data is referred to as “ n ”. in some embodiments , the ability of the system to detect fetal cardiac electrical activity data is increased by increasing the value of n . for example , by way of a non - limiting illustration , in some embodiments , the channels are specified as follows : in some embodiments , the signal data corresponding to fetal cardiac electrical activity data are extracted from the acquired signal data . fetal cardiac activity elicits a semi - periodic electrical signal , typically from about 0 . 1 to 100 hz . frequently , signals corresponding to fetal cardiac activity are contaminated with other electrical signals , including maternal cardiac electrical activity . the signal elicited by maternal cardiac activity can be 10 - fold greater than the fetal signal corresponding to fetal cardiac activity . see , for example , fig3 , showing an exemplary recording of cardiac electrical activity data , showing both maternal and fetal electrical activity combined . in some embodiments , the fetal cardiac electrical activity data are extracted from the acquired signal data by a method comprising : a . obtaining raw n - ecg signals data by recording electrical activity from the abdomen of a pregnant mother carrying a fetus using at least one ecg sensor pair ; b . applying a set of linear and no - linear mathematical transformations to the raw n - ecg signals data , thereby obtaining transformed / corrected n - ecg signals data ; and c . finding features in the transformed / corrected n - ecg signals data that correlates to fetal or maternal cardiac electrical activity . the term “ transformations ” as used herein refers to linear or non - linear mathematical transformations , which may include , inter alia , digital filtering , mathematical linear or non - linear decomposition , mathematical optimization . in some embodiments , the fetal cardiac electrical activity data are extracted from the acquired signal data using the algorithm shown in fig2 . using the algorithm shown in fig2 , the recorded signal data are pre - processed to remove noise (“ clean up signals ”), then the peaks of the maternal cardiac electrical activity are detected ( detect maternal peaks ”), the maternal cardiac activity signal data is removed (“ remove maternal signals ”), then the resulting data is processed to remove noise (“ clean up signals ”), then the peaks of the fetal cardiac electrical activity are detected ( detect fetal peaks ”), to detect fetal cardiac activity . the detected fetal activity data is then subsequently analyzed to calculate at least one of the parameters selected from the group consisting of : beat - to - beat fetal heart rate , fetal ecg , average fetal heart rate , and the variability of fetal heart rate . in some embodiments , the present invention provides a computer - implemented method , comprising : receiving , by at least one computer processor executing specific programmable instructions configured for the method , raw electrocardiogram ( ecg ) signals data from at least one pair of ecg sensors ; wherein the at least one pair of ecg sensors are positioned in on an abdomen of a woman carrying a fetus ; wherein the raw ecg signals data comprise data representative of a n number of raw ecg signals data ( raw n - ecg signals data ) which are being acquired in real - time from the at least one pair of ecg sensors ; digital signal filtering , by the at least one computer processor , the raw n - ecg signals data to form filtered n - ecg signals data having filtered n - ecg signals ; detecting , by the at least one computer processor , maternal heart peaks in each filtered ecg signal in the filtered n - ecg signals data ; subtracting , by the at least one computer processor , from each of n - ecg signal of the filtered n - ecg signals data , maternal ecg signal , by utilizing at least one non - linear subtraction procedure to obtain corrected ecg signals data which comprise data representative of a n number of corrected ecg signals , wherein the at least one non - linear subtraction procedure comprises : iteratively performing : i ) automatically dividing each ecg signal of n - ecg signals of the filtered n - ecg signals data into a plurality of ecg signal segments , 1 ) wherein each ecg signal segment of the plurality of ecg signal segments corresponds to a beat interval of a full heartbeat , and 2 ) wherein each beat interval is automatically determined based , at least in part on automatically detecting an onset value and an offset value of such beat interval ; ii ) automatically modifying each of the second plurality of filtered n - ecg signal segments to form a plurality of modified filtered n - ecg signal segments , wherein the modifying is performed using at least one inverse optimization scheme based on a set of parameters , wherein values of the set of parameters is determined based on : iteratively performing : 1 ) defining a global template based on a standard heartbeat profile of an adult human being , 2 ) setting a set of tentative values for a local template for each filtered n - ecg signal segment , 3 ) utilizing at least one optimization scheme to determine an adaptive template for each filtered n - ecg signal segment based on the local template being matched to the global template within a pre - determined similarity value ; and iii ) automatically eliminating the modified segments from each of the filtered n - ecg signals , by subtracting the adaptive template from the filtered n - ecg signal thereby generating each corrected ecg signal ; extracting , by the at least one computer processor , raw fetal ecg signals data from the filtered n - ecg signals data based on the corrected ecg signals data , wherein the raw fetal ecg signals data comprises a n number of fetal ecg signals ( raw n - ecg fetal signals data ); processing , by the at least one computer processor , the raw n - ecg fetal signals data to improve a signal - to - noise ratio of the raw n - ecg fetal signals data to form filtered n - ecg fetal signals data ; and detecting , by the at least one computer processor , fetal heart peaks in the filtered n - ecg fetal signals data ; and calculating , by the at least one computer processor , based on detected fetal heart peaks , at least one of : i ) fetal heart rate , ii ) fetal heart curve , iii ) beat - 2 - beat fetal heart rate , or iv ) fetal heart rate variability ; and outputting , by the at least one computer processor , a result of the calculating step . in some embodiments , the raw n - ecg signals data are preprocessed to remove noise , to generate filtered n - ecg signals data . in some embodiments , the preprocessing comprises applying a digital signaling filter selected from the group consisting of : a baseline wander filter , a power line frequency filter , and a high frequency filter . in some embodiments , the baseline wander filter is intended to remove low frequency compartments of the recorded signals and enhance fast time varying parts of the signal . in some embodiments , the baseline wander filter is a moving average filter with constant weights . in some embodiments , the moving average filter with a length of 501 milliseconds is used . in some embodiments , the baseline wander filter is a moving median filter . in some embodiments , the powerline frequency filter is intended to remove the power line interference that is picked up by the sensor pairs . in some embodiments , the cut - off frequency of powerline frequency filter is set to the powerline frequency of the geographical area where the system of the present invention is used . for example , if the system is used in europe , in some embodiments , the cut - off frequency is 49 . 5 to 50 . 5 hz . if the system is used in the usa , in some embodiments , the cut - off frequency is 59 . 5 to 60 . 5 hz . in some embodiments , the cut - off frequency of the powerline frequency filter is ± 10 hz of the powerline frequency of the geographical area where the system of the present invention is used . in some embodiments , the cut - off frequency of the powerline frequency filter is ± 5 hz of the powerline frequency of the geographical area where the system of the present invention is used . in some embodiments , a butterworth type band - step filter with a cut - off frequency of 49 . 5 to 50 . 5 hz whose order is 10th order , 5 sections is used . in some embodiments , a band - stop digital filter is used to attenuate the frequency components of the power line interference . in some embodiments , a digital adaptive filter is used to automatically determine the exact power line frequency before applying the band - stop filter . in some embodiments , the high frequency filter is intended to remove very high frequency compartments from the acquired signals . in some embodiments , the high frequency filter is a digital low pass filter . in some embodiments , the digital low pass filter is used to attenuates the high frequency compartments of the acquired signals . in some embodiments , the digital low pass filter is a chebyshev type i low pass filter . in some embodiments , the cutoff frequency of the low pass filter is set to 70 cycles / second . in some embodiments , the baseline ripple is 0 . 12 decibels . in some embodiments , the order is 12th order , 6 sections . in some embodiments , the high frequency filter is a smoothing filter . in some embodiments , the smoothing filter is used to attenuate the high frequency compartments of the raw n - ecg signals data . in some embodiments , the high frequency filter is an edge preserving filter . in some embodiments , the edge preserving filter is used to remove high frequency noise from the raw n - ecg signals data while preserving valuable information regarding the fetal and maternal ecg signals contained within the raw n - ecg signals data . in some embodiments , the edge preserving filter is an adaptive mean filter . in some embodiments , the edge preserving filter is an adaptive median filter . in some embodiments , an additional transformation is applied to the filtered n - ecg signals data . in some embodiments , a digital adaptive inverse - median filter is applied to the filtered n - ecg signals data to enhance the maternal ecg peaks . the term “ maternal ecg peaks ” as used herein refers any of the p , q , r , s or t waves of the electrical activity during a cardiac contraction cycle . fig4 shows a depiction of the electrical activity during a cardiac contraction cycle . in some embodiments , the additional transformation comprises applying an adaptive median filter to the n filtered n - ecg signals data , and subtracting the result filtered n - ecg signals data . in some embodiments , the length of the adaptive median filter is selected to be constant . in some embodiments , the length is set to 100 samples . in some embodiments , the length of the adaptive median filter is adapted depending on the local characteristics of the maternal ecg peaks . as used herein , the term “ local ” refers to the signal recorded from a sensor positioned in at a particular location on the abdomen of the pregnant mother . in some embodiments , the local characteristics are the duration of the qrs segment of the maternal electrical activity during a cardiac contraction cycle . in some embodiments , the local characteristics are the duration of the st segment of the maternal electrical activity during a cardiac contraction cycle . in some embodiments , the local characteristics are the duration of the pr segment of the maternal electrical activity during a cardiac contraction cycle . in some embodiments , the additional transformation comprises a decomposition to filtered n - ecg signals data to improve the signal to noise ratio . in some embodiments , the decomposition is a singular value decomposition ( svd ). in some embodiments , the decomposition is principle component analysis ( pca ). in some embodiments , the decomposition is independent component analysis ( ica ). in some embodiments , the decomposition is wavelet decomposition ( cwt ). in some embodiments , an additional high pass filter is applied to the decomposed filtered n - ecg signals data . in some embodiments , the high pass filter is 5 th order at 1 hz . in some embodiments , the decomposed n filtered signal data is examined by preliminary and simple peak detector . in some embodiments , the relative energy of the peaks is calculated ( relative to the overall energy of the signal ). in some embodiments , the decomposed filtered n - ecg signals data is given a quality score depending on this measure , decomposed filtered n - ecg signals data with a quality score of less than a threshold are excluded and the signals are examined for missing data and nans ( characters that are non - numerical ). in some embodiments , the quality score is assigned by calculating the relation ( energy of peaks )/( total energy of the filtered n - ecg signal ). in some embodiments , the energy of the temporary peaks is calculated by calculating the root mean square of the detected peaks . in some embodiments , the energy of the signal is calculated by calculating the root mean square of the filtered n - ecg signals . in some embodiments , the threshold is any value from 0 . 3 to 0 . 9 . in some embodiments , the threshold is 0 . 8 . detection of the portion of the acquired signals corresponding to maternal cardiac activity from the filtered n - ecg signals data and elimination of the signals corresponding to maternal cardiac activity from the filtered n - ecg signals data in some embodiments , maternal heart peaks in each filtered n - ecg signal in the filtered n - ecg signals data are detected and subtracted from each of n - ecg signal of the filtered n - ecg signals data , by utilizing at least one non - linear subtraction procedure to obtain corrected n - ecg signals data which comprise data representative of a n number of corrected ecg signals , wherein the at least one non - linear subtraction procedure comprises : iteratively performing : i ) automatically dividing each ecg signal of n - ecg signals of the filtered n - ecg signals data into a plurality of ecg signal segments , 1 ) wherein each ecg signal segment of the plurality of ecg signal segments corresponds to a beat interval of a full heartbeat , and 2 ) wherein each beat interval is automatically determined based , at least in part on automatically detecting an onset value and an offset value of such beat interval ; ii ) automatically modifying each of the second plurality of filtered n - ecg signal segments to form a plurality of modified filtered n - ecg signal segments , wherein the modifying is performed using at least one inverse optimization scheme based on a set of parameters , wherein values of the set of parameters is determined based on : iteratively performing : 1 ) defining a global template based on a standard heartbeat profile of an adult human being , 2 ) setting a set of tentative values for a local template for each filtered n - ecg signal segment , 3 ) utilizing at least one optimization scheme to determine an adaptive template for each filtered n - ecg signal segment based on the local template being matched to the global template within a pre - determined similarity value ; and iii ) automatically eliminating the modified segments from each of the filtered n - ecg signals , by subtracting the adaptive template from the filtered n - ecg signal thereby generating each corrected ecg signal . examples of adaptive templates according to some embodiments of the present invention are shown in fig4 and 8 . in some embodiments , detecting of the maternal heart peaks in each filtered ecg signal in the filtered n - ecg signals data is performed based at least on : i ) dividing each filtered ecg signal into a first plurality of ecg signal segments ; ii ) normalizing a filtered ecg signal in each ecg signal segment ; iii ) calculating a first derivative of the filtered ecg signal in each ecg signal segment ; iv ) finding local maternal heart peaks in each ecg signal segment based on determining a zero - crossing of the first derivative ; and v ) excluding the local maternal heart peaks having at least one of : 1 ) an absolute value which is less than a pre - determined local peak absolute threshold value ; or 2 ) a distance between the local peaks is less than a pre - determined local peak distance threshold value . in some embodiments , the pre - determined similarity value is based on an euclidian distance , wherein the set of parameters is a local minima solution to a non - linear least squares problem solved by at least one of : 1 ) minimizing a cost function taken as the euclidian distance ; 2 ) utilizing a gauss - newton algorithm ; 3 ) utilizing a steepest - descent ( gradient - descent ) algorithm ; or 4 ) utilizing a levenberg - marquardt algorithm . in some embodiments , the length of each segment is set at 10 seconds . in some embodiments , the length of each segment is selected automatically depending on the length of the recording . in some embodiments , the signal data in each segment is normalized by the absolute maximum value of the signal data . in some embodiments , the signal data in each segment is normalized by the absolute non - zero minimum value of the signal data . in some embodiments , a first order forward derivative is used . in some embodiments , a first order central derivative is used . in some embodiments , the threshold is selected to be a constant value of 0 . 3 . in some embodiments , the threshold is selected depending on the local characteristics of the signal data . in some embodiments , the local characteristic of the signal is the median value of the signal data or any multiplication of this value . in some embodiments , the local characteristic of the signal is the mean value of the signal data or any multiplication of this value . in some embodiments , the threshold on the distance is selected to be 100 samples . in some embodiments , the local characteristics of the signal can be the maximum predicted rr internal or any multiple of this value . in some embodiments , a “ peaks array ” is generated from the filtered n - ecg signals data . in some embodiments , the peak array comprises the number of detected peaks for each of the segments of the filtered n - ecg signals data . in some embodiments , clustering is performed on the peaks array . in some embodiments , k - means clustering is used to group the peaks into a number of clusters . in some embodiments , k - medoids clustering is used to group the peaks into a number of clusters . in some embodiments , the number of clusters for the clustering is set to be three . in some embodiments , the number of clusters for the clustering is selected automatically depending on the characteristics of the processed n filtered signal data . in some embodiments , the clustering is used to exclude outliers . in some embodiments , outliers are peaks that have anomalous characteristics . in some embodiments , the characteristic is the distance between a peak and its neighboring peaks . in some embodiments , the characteristic is the amplitude of the peak . in some embodiments , a new peak array is constructed after the exclusion of the anomalous peaks . in some embodiments , the new peak array is further analyzed and the peaks are scored depending on the signal to noise ratio of the filtered n - ecg signals data . in some embodiments , the signal to noise ratio score is calculated by calculating the relative energy of the qrs complexes from the overall energy of the processed n filtered signal data . in some embodiments , the detected peaks for each of the filtered n - ecg signals data are fused for a more robust detection . in some embodiments , the fusion of the detected peaks is done using the scores given for each of the peaks of the filtered n - ecg signals data . in some embodiments , a global array of peaks is defined using the fused peaks . in some embodiments , the peaks of each of the filtered n - ecg signals data is redetected and the positions are refined using the global peaks array . in some embodiments , the global peak array is constructed based on the best lead with corrections made using the peaks from the other leads and the global peaks array is examined using physiological measures , such as , for example , rr intervals , hr , hrv ). in some embodiments , after the peaks have been defined , the filtered n - ecg signals data is further transformed to eliminate the signals corresponding to maternal cardiac activity . in some embodiments , the transformations / corrections include applying non - linear subtraction to the filtered n - ecg signals data . in some embodiments , the remaining data comprises signal data corresponding to fetal cardiac activity and noise . in some embodiments of the invention , the non - linear subtraction procedure is applied separately for each one of the processed n filtered signal data . in some embodiments , the non - linear subtraction procedure is applied to all of the processed n filtered signal data in series , in any order . in some embodiments , the non - linear subtraction procedure is applied to all of the processed n filtered signal data simultaneously . in some embodiments , the non - linear subtraction comprises : dividing the processed n filtered signal data into a large number of segments ; modifying each of the segments , separately or jointly , using an inverse optimization scheme ; and eliminating the modified segments from the original processed n filtered signal data , thereby obtaining n raw fetal signal data . the term ‘ segmentation ’, as used herein , refers to the division of the processed n filtered signal data into any given number of segments . in some embodiments , the number of segments is set to be a function of the number of the detected maternal peaks . in some embodiments , the function is the identity function so that the number of segments equals the number of the detected maternal peaks , in which case , each segment is a full heartbeat . in some embodiments , a beat interval is defined . the term ‘ beat interval ’ used hereinafter refers the time interval of a single maternal heart beat . in some embodiments , the beat interval is taken to be constant and is defined as 500 milliseconds before the r - peak position and 500 milliseconds after the r - peak position . in some embodiments , the beat interval is detected automatically by detecting the beat onset and beat offset of each beat . thus , the beat interval depends on the local heart rate value and a more accurate segmentation of the ecg signal is achieved . in some embodiments , the beat interval onset is defined as the onset ( i . e . starting point in time ) of the p - wave . in some embodiments , the beat interval offset is defined as the offset ( i . e . end point in time ) of the t wave . in some embodiments , the beat interval onset for the current beat is defined as half the way , in time , between the previous beat and the current beat . in some embodiments , the beat interval offset for the current beat is defined as half the way , in time , between the current beat and the next beat . in some embodiments , a second segmentation step is performed on the result of the previous segmentation . the product of this segmenting step is referred to as ‘ in - beat segments ’. in some embodiments , the number of in - beat segments is selected to be any integer number between one and the number of time samples in the current beat . by way of non - limiting example , the number of in - beat segment can be three . in some embodiments , an automatic procedure is performed to detect the optimal number of in - beat segments . in some embodiments , the automatic procedure comprises using a divide and conquer algorithm , wherein each segment is divided into two equal sub - segments . if the energy content of a sub - segment exceeds a pre - defined relative threshold , the sub - segment itself is divided into two sub - segments and so on recursively . the stop criterion can be reaching a minimum length of sub - segment , reaching a maximum number of segments or dividing into sub - segments such that all of them meet the energy threshold criterion . in certain embodiments , the entropy measure is used to divide the segment into sub - segments . in this case , the entropy of each segment is minimized . in some embodiments , the result of the in - beat segmentation is the following seven segments : 1 . the isoelectric line from the beat onset to the onset of the p wave ; 2 . the p wave ; 3 . the isoelectric line from offset of the p wave to the onset of the qrs complex ; 4 . the qrs complex ; 5 . the isoelectric line from the offset of the qrs complex to the onset of the t wave ; 6 . the t wave ; and 7 . the isoelectric line from the offset of the t wave to the beat offset . in some embodiments , the majority of the energy of the filtered n - ecg signals data is in the qrs complex . thus , in some embodiments , the in - beat segments a the following three in - beat segments : 1 . from the beat onset to the onset of the qrs complex ; 2 . the qrs complex ; and 3 . from the offset of the qrs complex to the beat offset . in some embodiments , the onset and offset of the qrs complex , for each of the beats in the ecg signal , are automatically detected using a dedicated method comprising : applying a digital band pass filter to the filtered n - ecg signals data ; calculating the curve length transform of the filtered n - ecg signals data ; selecting the values of the data that are higher than a threshold ; calculating the first derivative of the transformed data ; finding the positive transitions and negative transitions in the derivative data ; finding pairs of the positive - and - negative transition such that the distance between them , in time samples , is higher than a pre - selected threshold ; setting the onset of the qrs complex as the position , in time , of the positive transition from the selected pair ; and setting the offset of the qrs complex as the position in time of the negative transition from the selected pair . in some embodiments , the cutoff frequencies of the band pass filter are set to be 5 and 20 cycles / sec for the lower and upper frequencies respectively . in some embodiments , the threshold is set to be a constant value of 0 . 3 . in some embodiments , the threshold value is calculated automatically depending of the local characteristics of the data after the curve length transform . in some embodiments , the local characteristic of the data is the mean value of the transformed data . in some embodiments , the segmentation also comprises an additional complementary transformation that comprises changing the sample rate of the signal by an integer value . in some embodiments , the additional complementary transformation reduces the variability of the resulting raw n - ecg fetal signals data caused by the fine positions of the onsets and offsets of the selected segments . in some embodiments the sample rate is decreased by a factor of 4 to decrease the calculation time . alternatively , in certain embodiments , the sample rate is increased by a factor of 4 . in some embodiments , increasing the sample rate is done using interpolation . in some embodiments , increasing the sample rate is done by zero padding the data and then applying a set of low pass fir filters . in some embodiments , changing the sample rate of the signals is done before the segmentation procedure . in some embodiments , changing the sample rate is done after the segmentation . in these embodiments , the selected onsets and offsets of the different segments are refined depending on the signals after changing the sample rate . in some embodiments , the segmentation is updated depending on the convergence of the iterative methods in the next steps described hereinafter . in some embodiments , the selected segments are modified using a nonlinear parametric transformation in which the values of a predefined set of parameters are changed according to some criterion . in some embodiments , the values of a predefined set of parameters are determined and modified according to a method comprising : defining reference vectors as , for each filtered n - ecg signals data , the ecg signal and its segments ( called ‘ measured potentials ’ hereinafter ); and finding the values of the set of parameters that provide a good fit to results of the measured potentials . a “ good fit ” occurs when the difference between the adapted template and the measured potentials is very small . in one embodiment , very small is defined to be 10 − 5 or smaller . in other embodiments , “ very small ” is defined as 10 − 6 or smaller or 10 − 4 or smaller or 10 − 7 or smaller or other exponents of 10 or other numbers . in some embodiments , the difference between the adapted template and the measured potentials is the l2 norm of the element - by - element subtraction between the two vectors . in some embodiments , the values of a predefined set of parameters also include parameters that change the amplitude of a time signal . in some embodiments , an iterative scheme is used to determine the values of the set of the parameters , comprising : selecting starting conditions ; assigning tentative values to the set of parameters ; adapting the templates using the set of parameters ; comparing the adapted templates to the measured potentials ; checking if a stop criterion is reached ; updating the values of the set of parameters if none of the stop criteria are reached , and repeating steps ( c ), ( d ), ( e ) and ( f ). in some embodiments , if a stop criterion is reached , the iterative procedure is terminated and the current set of parameters is deemed the optimal solution of the optimization problem . in some embodiments , the starting conditions are set to be the ecg templates . in some embodiments , two templates are defined : the first is a global template that is defined for every ecg beat ( see , for example , fig7 ), wherein the template is calculated as a weighted average of m beats . in some embodiments , m is an integer number between 2 and the total number of beats in the ecg signal . in some embodiments , the weights used in the weighted average are equal yielding a normal averaging . in some embodiments , the m beats fulfill the condition that the correlation coefficient between each of the beats should be higher than a threshold . in certain embodiments , the threshold is set to be 0 . 98 . in some embodiments , before the averaging , the beats are shifted and fine aligned using the exact position of the r - wave , the qrs onset and the qrs offset . in some embodiments , the alignment procedure is done using the cross correlation function . in some embodiments , the m beats fulfill the condition that relation between the energy of the template , defined as an average of these beats , and the energy of the current ecg beat is bounded close to 1 . however , in some embodiments , the relation between the energy of the template and the energy of the current ecg beat is higher than 1 by a small value or lower than 1 by a small value . the second is a local template that is defined for each of the sub - segments in the current beat ( see , for example , fig8 ). in some embodiments , the template is calculated as the average of the sub - segments in the m - selected peaks . in some embodiments , the beats are selected to fulfill the conditions that the local heart rate is similar to the local heart rate for the current beat . by means of a non - limiting example , the heart rate values are close by a factor of 1 . 5 . in some embodiments , the tentative values are set to random numbers . in some embodiments , the tentative values are set to be constant numbers ; by means of a non - limiting example , they are set to be 1 . in some embodiments , the tentative values are saved between different executions of the algorithm and used if available . in some embodiments , the different templates are adapted separately depending on the appropriate parameters that are assigned to the templates . in some embodiments , the templates are scaled by multiplying the templates vectors with the appropriate set of parameters . in some embodiments , the templates are shifted in time using the appropriate set of parameters . in some embodiments , the euclidian distance is used to compare the two sets of vectors ; the adapted templates and the measured potentials from the processed n filtered signal data . in some embodiments , the cost function is defined as the error energy function . in some embodiments , the city - block measure is used to compare the adapted templates to the measured potentials . in some embodiments , the cross correlation function is used to compare the adapted templates and measured potentials . in some embodiments , a “ good fit ” is a correlation of 0 . 95 or greater . in some embodiments , a maximum number of iterations is used as a stop criterion . in some embodiments , in the case of using the euclidian distance as a similarity measure , the value of the error energy function at a specific iteration is used as a stop criterion . in some embodiments , if the error energy becomes lower than a threshold , the stop criterion is reached . in certain embodiments , the threshold is set to be constant . by means of a non - limiting example , it is set to be 10 − 5 . in some embodiments , the threshold is calculated depending on the characteristics of the iterative procedure . for example , in some embodiments , the characteristics of the iterative procedure is the maximum number of allowed iterations ; in other embodiments , the characteristics of the iterative procedure is the used cost function , for example the euclidian distance function ; and still other embodiments , the characteristics of the iterative procedure is the number of time samples in the templates . in some embodiments , an improvement measure is used as a stop criterion . in some embodiments , the change in the set of parameters is used as an improvement measure . in some embodiments , if the values of the set of parameters does not change , or change slightly , the stop criterion is fulfilled . in some embodiments , the change in the value of the cost function , e . g . the error energy function , is used as an improvement measure . in some embodiments , if a stop criterion is reached , an optimization scheme is applied to update the values of the set of parameters . in some embodiments , when using the euclidian distance as a similarity measure , the optimization problem becomes a non - linear least squares problem . in some embodiments , the solution of this problem gives the optimal set of parameters that minimizes the cost function taken as the euclidian distance . in some embodiments , gauss - newton algorithm is used to solve the non - linear least squares problem . in some embodiments , the steepest - descent ( gradient - descent ) method is used to solve the non - linear least squares problem . in some embodiments , the levenberg - marquardt algorithm is used to solve the non - linear least squares problem . in these embodiments , the problem becomes a damped least squares problem . levenberg - marquardt algorithm is a method , which interpolates between the gradient - descent and gauss - newton algorithm taking advantage of both methods to increase the convergence accuracy and decrease the convergence time . in some embodiments , gradient - descent , gauss - newton algorithm and levenberg - marquardt algorithm , are iterative methods that are repeated a number of times , potentially , bringing the euclidian distance ( the error energy function ) to a local minima . in some embodiments , updating the set of parameters is performed using the relation : p k + 1 = p k −[ k t k + λ i · diag ( k t k )] − 1 * k t [ φ c ( p k )− φ m ] where p k is the set of parameters at the k th iteration ; and φ c ( p k ) is the adapted version of the templates for the p k parameters ; and λ i is the damping parameter in the levenberg - marquardt algorithm ; and φ m is the measured potentials ( measured ecg signals ); and k is the jacobian matrix calculated for the set of parameters p k by altering the values of the parameters ; and diag ( k t k ) is the diagonal of the approximated hessian matrix . in some embodiments , eliminating the modified segments from the n raw signal data is achieved by subtracting the adapted templates from the measured potentials . in some embodiments , the subtraction results in n raw fetal signal data . in some embodiments , the n raw fetal signal data comprises noise and fetal cardiac electrical activity data . in some embodiments , maternal cardiac activity is eliminated using the algorithm shown in fig5 . in some embodiments , maternal cardiac activity is eliminated using the algorithm shown in fig6 . a representative result of maternal ecg elimination according to some embodiments of the present invention is shown in fig9 . in some embodiments , raw fetal ecg signals data is extracted and analyzed by utilizing a blind - source - separation ( bss ) algorithm on ( 1 ) the filtered n - ecg signals data and ( 2 ) the corrected n - ecg signals data , wherein the raw fetal ecg signals data comprises a n number of fetal ecg signals ( n - ecg fetal signals ); processing , by the at least one computer processor , the raw fetal ecg signals data to improve a signal - to - noise ratio by at least : i ) applying a band - pass filter within a range of 15 - 65 hz to break the plurality of raw n - ecg fetal signals in to a plurality of frequency channels , ii ) scoring an ecg fetal signal per channel based on a peak - 2 - mean analysis to identify a plurality of fetal heartbeat channels , wherein each fetal heartbeat channel corresponds to a particular fetal ecg fetal signal ; and iii ) selecting the identified plurality of fetal heartbeat channels into filtered fetal ecg signals data , comprising a n number of filtered fetal ecg signals ( filtered n - ecg fetal signals data ); detecting , by the at least one computer processor , fetal heart peaks in the filtered n - ecg fetal signals data , by performing at least : i ) dividing each filtered n - ecg fetal signal into a first plurality of fetal ecg signal segments ; ii ) normalizing a filtered fetal ecg signal in each fetal ecg signal segment ; iii ) calculating a first derivative of the filtered fetal ecg signal in each fetal ecg signal segment ; and iv ) finding local fetal heart peaks in each fetal ecg signal segment based on determining a zero - crossing of the first derivative ; calculating , by the at least one computer processor , based on detected fetal heart peaks , at least one of : i ) fetal heart rate , ii ) fetal heart curve , iii ) beat - 2 - beat fetal heart rate , or iv ) fetal heart rate variability ; and outputting , by the at least one computer processor , a result of the calculating step . in some embodiments , the processing of the raw n - ecg fetal signals data to improve the signal - to - noise ratio comprises : i ) applying a band - pass filter within a range of 15 - 65 hz to break the plurality of n - ecg fetal signals in to a plurality of frequency channels , ii ) scoring an ecg fetal signal per channel based on a peak - 2 - mean analysis to identify a plurality of fetal heartbeat channels , wherein each fetal heartbeat channel corresponds to a particular fetal ecg fetal signal ; and iii ) selecting the identified plurality of fetal heartbeat channels into filtered ecg fetal signals data , comprising a n number of filtered fetal ecg signals ( filtered n - ecg fetal signals data ). in some embodiments , the processing of the raw n - ecg fetal signals data to improve the signal - to - noise ratio comprises : i ) applying a band - pass filter within a range of 1 - 70 hz to break the plurality of n - ecg fetal signals in to a plurality of frequency channels , ii ) scoring an ecg fetal signal per channel based on a peak - 2 - mean analysis to identify a plurality of fetal heartbeat channels , wherein each fetal heartbeat channel corresponds to a particular fetal ecg fetal signal ; and iii ) selecting the identified plurality of fetal heartbeat channels into filtered ecg fetal signals data , comprising a n number of filtered fetal ecg signals ( filtered n - ecg fetal signals data ). in some embodiments , the processing of the raw n - ecg fetal signals data to improve the signal - to - noise ratio comprises : i ) applying a band - pass filter within a range of 5 - 70 hz to break the plurality of n - ecg fetal signals in to a plurality of frequency channels , ii ) scoring an ecg fetal signal per channel based on a peak - 2 - mean analysis to identify a plurality of fetal heartbeat channels , wherein each fetal heartbeat channel corresponds to a particular fetal ecg fetal signal ; and iii ) selecting the identified plurality of fetal heartbeat channels into filtered ecg fetal signals data , comprising a n number of filtered fetal ecg signals ( filtered n - ecg fetal signals data ). in some embodiments , the processing of the raw n - ecg fetal signals data to improve the signal - to - noise ratio comprises : i ) applying a band - pass filter within a range of 10 - 70 hz to break the plurality of n - ecg fetal signals in to a plurality of frequency channels , ii ) scoring an ecg fetal signal per channel based on a peak - 2 - mean analysis to identify a plurality of fetal heartbeat channels , wherein each fetal heartbeat channel corresponds to a particular fetal ecg fetal signal ; and iii ) selecting the identified plurality of fetal heartbeat channels into filtered ecg fetal signals data , comprising a n number of filtered fetal ecg signals ( filtered n - ecg fetal signals data ). in some embodiments , the processing of the raw n - ecg fetal signals data to improve the signal - to - noise ratio comprises : i ) applying a band - pass filter within a range of 1 - 65 hz to break the plurality of n - ecg fetal signals in to a plurality of frequency channels , ii ) scoring an ecg fetal signal per channel based on a peak - 2 - mean analysis to identify a plurality of fetal heartbeat channels , wherein each fetal heartbeat channel corresponds to a particular fetal ecg fetal signal ; and iii ) selecting the identified plurality of fetal heartbeat channels into filtered ecg fetal signals data , comprising a n number of filtered fetal ecg signals ( filtered n - ecg fetal signals data ). in some embodiments , the processing of the raw n - ecg fetal signals data to improve the signal - to - noise ratio further comprises at least one of : 1 ) utilizing a singular - value - decomposition ( svd ) technique ; or 2 ) utilizing a wavelet - denoising ( wd ) technique . in some embodiments , all of the raw n - ecg signals data are used in the bss procedure so that the bss procedure is applied to 2n signals . in other embodiments , only part of the raw n - ecg signals data is used in the bss procedure so that the bss procedure is applied to between n + 1 signals and less than 2n signals . in some embodiments , principal component analysis ( pca ) is used as the bss method . in some embodiments , independent component analysis ( ica ) is used as the bss method . in some embodiments , the results of the bss procedure is further analyzed to improve the signal to noise ratio of the signals . in some embodiments , the further analysis includes a band - pass filter in the range of 15 - 65 cycle / second . in some embodiments , the further analysis includes applying singular - value - decomposition ( svd ). in some embodiments , the further analysis includes applying wavelet - denoising . in some embodiments , the further analysis includes applying ‘ peak - 2 - mean ’ transformation , which in some versions is in a separate software module , that comprises : max ⁡ ( signal ⁡ [ win ] ) mean ⁡ ( signal ⁡ [ win ] ) ; b . calculating the 1st derivative of the result of step a ; and c . finding the zero crossing to find peaks taking the negative part of the derivative ; and d . finding the peaks in the previous result and cluster them based on the difference between them . identify the best group as the group with the maximum score defined as : scr = n / rms where n is the number of peaks in each cluster and rms is the energy of the derivative of the distances between the peaks ; and e . performing a prediction for the rr interval for the best group ; and f . if the prediction doesn &# 39 ; t fit the real physiological model of the fetal rr intervals , the current signal is ignored and one then begins the process at the beginning ( i . e . using a moving window to calculate the relation ) with the next signal ; and g . if the prediction does fit the real physiological model of the fetal rr , calculate the auto correlation function of a windowed rms of the signal . if the result has a narrow distribution , the current signal is ignored , and if the result does not have a narrow distribution , then proceed as follows : h . applying agc to the negative derivative signal ; and i . normalizing the result . in certain embodiments , the above ‘ peak - 2 - mean transformation ’ is applied separately to each signal ( i . e . each of the 2n signals or each of the between n + 1 and less than 2n signals ). in some embodiments , fetal heart beat detection is performed . for example , in some embodiments , the n raw fetal signal data are subjected the fetal peak detection procedure before the further analysis and in other embodiments the results of the further analysis subjected to the fetal peak detection procedure . in some embodiments , the analysis comprises : dividing the n filtered fetal signal data into segments ; normalizing the signal data in each segment ; calculating the first derivative of the normalized signal data ; identifying the fetal ecg peaks within the normalized signal data by determining the zero - crossing of the first derivative ; excluding peaks whose absolute value is less than a threshold pre - selected by the user ; and excluding very close peaks where the distance between them is less than a threshold , thereby obtaining processed n filtered fetal signal data . in some embodiments , the length of each segment is set at 10 seconds . in some embodiments , the length of each segment is selected automatically depending on the length of the recording . in some embodiments , the signal data in each segment is normalized by the absolute maximum value of the signal data . in some embodiments , the signal data in each segment is normalized by the absolute non - zero minimum value of the signal data . in some embodiments , a first order forward derivative is used . in some embodiments , a first order central derivative is used . in some embodiments , the threshold is selected to be a constant value of 0 . 3 . in some embodiments , the threshold is selected depending on the local characteristics of the signal data . in some embodiments , the local characteristic of the signal is the median value of the signal data or any multiplication of this value . in some embodiments , the local characteristic of the signal is the mean value of the signal data or any multiplication of this value . in some embodiments , the threshold on the distance is selected to be 100 samples . in some embodiments , the local characteristics of the signal can be the maximum predicted rr internal or any multiple of this value . in some embodiments , a “ peaks array ” is generated from the filtered n - ecg fetal signals data . in some embodiments , the peak array comprises the number of detected peaks for each of the segments of the filtered n - ecg fetal signals data . in some embodiments , clustering is performed on the peaks array . in some embodiments , k - means clustering is used to group the peaks into a number of clusters . in some embodiments , k - medoids clustering is used to group the peaks into a number of clusters . in some embodiments , the number of clusters for the clustering is set to be three . in some embodiments , the number of clusters for the clustering is selected automatically depending on the characteristics of the filtered n - ecg fetal signals data . in some embodiments , the clustering is used to exclude outliers . in some embodiments , outliers are peaks that have anomalous characteristics . in some embodiments , the characteristic is the distance between a peak and its neighboring peaks . in some embodiments , the characteristic is the amplitude of the peak . in some embodiments , a new peak array is constructed after the exclusion of the anomalous peaks . in some embodiments , the new peak array is further analyzed and the peaks are scored depending on the signal to noise ratio of the filtered n - ecg fetal signals data . in some embodiments , the signal to noise ratio score is calculated by calculating the relative energy of the qrs complexes from the overall energy of the filtered n - ecg fetal signals data . in some embodiments , the detected peaks for each of the filtered n - ecg fetal signals data are fused for a more robust detection . in some embodiments , the fusion of the detected peaks is done using the scores given for each of the peaks of filtered n - ecg fetal signals data . in some embodiments , a global array of peaks is defined using the fused peaks . in some embodiments , the peaks of each of the filtered n - ecg fetal signals data is redetected and the positions are refined using the global peaks array . in some embodiments , the global peak array is constructed based on the best lead with corrections made using the peaks from the other leads and the global peaks array is examined using physiological measures , such as , for example , rr intervals , hr , hrv ). in some embodiments , the beat - to - beat fetal heart rate is extracted from the detected fetal peaks positions . in some embodiments , the fetal heart curve is also extracted from the detected fetal peak positions . the present invention is further illustrated , but not limited by , the following examples . publications cited throughout this document are hereby incorporated by reference in their entirety . although the various aspects of the invention have been illustrated above by reference to examples and preferred embodiments , it will be appreciated that the scope of the invention is defined not by the foregoing description but by the following claims properly construed under principles of patent law .
the invention provides systems and methods for monitoring the wellbeing of a fetus by the non - invasive detection and analysis of fetal cardiac electrical activity data .