repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._build_session
def _build_session(self, name, start_info, end_info): """Builds a session object.""" assert start_info is not None result = api_pb2.Session( name=name, start_time_secs=start_info.start_time_secs, model_uri=start_info.model_uri, metric_values=self._build_session_metric_values...
python
def _build_session(self, name, start_info, end_info): """Builds a session object.""" assert start_info is not None result = api_pb2.Session( name=name, start_time_secs=start_info.start_time_secs, model_uri=start_info.model_uri, metric_values=self._build_session_metric_values...
[ "def", "_build_session", "(", "self", ",", "name", ",", "start_info", ",", "end_info", ")", ":", "assert", "start_info", "is", "not", "None", "result", "=", "api_pb2", ".", "Session", "(", "name", "=", "name", ",", "start_time_secs", "=", "start_info", "."...
Builds a session object.
[ "Builds", "a", "session", "object", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L132-L145
train
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._build_session_metric_values
def _build_session_metric_values(self, session_name): """Builds the session metric values.""" # result is a list of api_pb2.MetricValue instances. result = [] metric_infos = self._experiment.metric_infos for metric_info in metric_infos: metric_name = metric_info.name try: metric...
python
def _build_session_metric_values(self, session_name): """Builds the session metric values.""" # result is a list of api_pb2.MetricValue instances. result = [] metric_infos = self._experiment.metric_infos for metric_info in metric_infos: metric_name = metric_info.name try: metric...
[ "def", "_build_session_metric_values", "(", "self", ",", "session_name", ")", ":", "# result is a list of api_pb2.MetricValue instances.", "result", "=", "[", "]", "metric_infos", "=", "self", ".", "_experiment", ".", "metric_infos", "for", "metric_info", "in", "metric_...
Builds the session metric values.
[ "Builds", "the", "session", "metric", "values", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L147-L170
train
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._aggregate_metrics
def _aggregate_metrics(self, session_group): """Sets the metrics of the group based on aggregation_type.""" if (self._request.aggregation_type == api_pb2.AGGREGATION_AVG or self._request.aggregation_type == api_pb2.AGGREGATION_UNSET): _set_avg_session_metrics(session_group) elif self._request...
python
def _aggregate_metrics(self, session_group): """Sets the metrics of the group based on aggregation_type.""" if (self._request.aggregation_type == api_pb2.AGGREGATION_AVG or self._request.aggregation_type == api_pb2.AGGREGATION_UNSET): _set_avg_session_metrics(session_group) elif self._request...
[ "def", "_aggregate_metrics", "(", "self", ",", "session_group", ")", ":", "if", "(", "self", ".", "_request", ".", "aggregation_type", "==", "api_pb2", ".", "AGGREGATION_AVG", "or", "self", ".", "_request", ".", "aggregation_type", "==", "api_pb2", ".", "AGGRE...
Sets the metrics of the group based on aggregation_type.
[ "Sets", "the", "metrics", "of", "the", "group", "based", "on", "aggregation_type", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L172-L191
train
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._sort
def _sort(self, session_groups): """Sorts 'session_groups' in place according to _request.col_params.""" # Sort by session_group name so we have a deterministic order. session_groups.sort(key=operator.attrgetter('name')) # Sort by lexicographical order of the _request.col_params whose order # is no...
python
def _sort(self, session_groups): """Sorts 'session_groups' in place according to _request.col_params.""" # Sort by session_group name so we have a deterministic order. session_groups.sort(key=operator.attrgetter('name')) # Sort by lexicographical order of the _request.col_params whose order # is no...
[ "def", "_sort", "(", "self", ",", "session_groups", ")", ":", "# Sort by session_group name so we have a deterministic order.", "session_groups", ".", "sort", "(", "key", "=", "operator", ".", "attrgetter", "(", "'name'", ")", ")", "# Sort by lexicographical order of the ...
Sorts 'session_groups' in place according to _request.col_params.
[ "Sorts", "session_groups", "in", "place", "according", "to", "_request", ".", "col_params", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L199-L226
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioAnalysisRecordAlsa.py
recordAnalyzeAudio
def recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType): ''' recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType) This function is used to record and analyze audio segments, in a fix window basis. ARGUMENTS: - duration total recording dura...
python
def recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType): ''' recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType) This function is used to record and analyze audio segments, in a fix window basis. ARGUMENTS: - duration total recording dura...
[ "def", "recordAnalyzeAudio", "(", "duration", ",", "outputWavFile", ",", "midTermBufferSizeSec", ",", "modelName", ",", "modelType", ")", ":", "if", "modelType", "==", "'svm'", ":", "[", "Classifier", ",", "MEAN", ",", "STD", ",", "classNames", ",", "mtWin", ...
recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType) This function is used to record and analyze audio segments, in a fix window basis. ARGUMENTS: - duration total recording duration - outputWavFile path of the output WAV file - midTermBufferSizeSec (fix)segment length in...
[ "recordAnalyzeAudio", "(", "duration", "outputWavFile", "midTermBufferSizeSec", "modelName", "modelType", ")" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioAnalysisRecordAlsa.py#L62-L125
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audacityAnnotation2WAVs.py
annotation2files
def annotation2files(wavFile, csvFile): ''' Break an audio stream to segments of interest, defined by a csv file - wavFile: path to input wavfile - csvFile: path to csvFile of segment limits Input CSV file must be of the format <T1>\t<T2>\t<Label> ...
python
def annotation2files(wavFile, csvFile): ''' Break an audio stream to segments of interest, defined by a csv file - wavFile: path to input wavfile - csvFile: path to csvFile of segment limits Input CSV file must be of the format <T1>\t<T2>\t<Label> ...
[ "def", "annotation2files", "(", "wavFile", ",", "csvFile", ")", ":", "[", "Fs", ",", "x", "]", "=", "audioBasicIO", ".", "readAudioFile", "(", "wavFile", ")", "with", "open", "(", "csvFile", ",", "'rb'", ")", "as", "csvfile", ":", "reader", "=", "csv",...
Break an audio stream to segments of interest, defined by a csv file - wavFile: path to input wavfile - csvFile: path to csvFile of segment limits Input CSV file must be of the format <T1>\t<T2>\t<Label>
[ "Break", "an", "audio", "stream", "to", "segments", "of", "interest", "defined", "by", "a", "csv", "file", "-", "wavFile", ":", "path", "to", "input", "wavfile", "-", "csvFile", ":", "path", "to", "csvFile", "of", "segment", "limits", "Input", "CSV", "fi...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audacityAnnotation2WAVs.py#L9-L30
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioBasicIO.py
convertDirMP3ToWav
def convertDirMP3ToWav(dirName, Fs, nC, useMp3TagsAsName = False): ''' This function converts the MP3 files stored in a folder to WAV. If required, the output names of the WAV files are based on MP3 tags, otherwise the same names are used. ARGUMENTS: - dirName: the path of the folder where the MP3s...
python
def convertDirMP3ToWav(dirName, Fs, nC, useMp3TagsAsName = False): ''' This function converts the MP3 files stored in a folder to WAV. If required, the output names of the WAV files are based on MP3 tags, otherwise the same names are used. ARGUMENTS: - dirName: the path of the folder where the MP3s...
[ "def", "convertDirMP3ToWav", "(", "dirName", ",", "Fs", ",", "nC", ",", "useMp3TagsAsName", "=", "False", ")", ":", "types", "=", "(", "dirName", "+", "os", ".", "sep", "+", "'*.mp3'", ",", ")", "# the tuple of file types", "filesToProcess", "=", "[", "]",...
This function converts the MP3 files stored in a folder to WAV. If required, the output names of the WAV files are based on MP3 tags, otherwise the same names are used. ARGUMENTS: - dirName: the path of the folder where the MP3s are stored - Fs: the sampling rate of the generated WAV files ...
[ "This", "function", "converts", "the", "MP3", "files", "stored", "in", "a", "folder", "to", "WAV", ".", "If", "required", "the", "output", "names", "of", "the", "WAV", "files", "are", "based", "on", "MP3", "tags", "otherwise", "the", "same", "names", "ar...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioBasicIO.py#L5-L38
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioBasicIO.py
convertFsDirWavToWav
def convertFsDirWavToWav(dirName, Fs, nC): ''' This function converts the WAV files stored in a folder to WAV using a different sampling freq and number of channels. ARGUMENTS: - dirName: the path of the folder where the WAVs are stored - Fs: the sampling rate of the generated WAV fil...
python
def convertFsDirWavToWav(dirName, Fs, nC): ''' This function converts the WAV files stored in a folder to WAV using a different sampling freq and number of channels. ARGUMENTS: - dirName: the path of the folder where the WAVs are stored - Fs: the sampling rate of the generated WAV fil...
[ "def", "convertFsDirWavToWav", "(", "dirName", ",", "Fs", ",", "nC", ")", ":", "types", "=", "(", "dirName", "+", "os", ".", "sep", "+", "'*.wav'", ",", ")", "# the tuple of file types", "filesToProcess", "=", "[", "]", "for", "files", "in", "types", ":"...
This function converts the WAV files stored in a folder to WAV using a different sampling freq and number of channels. ARGUMENTS: - dirName: the path of the folder where the WAVs are stored - Fs: the sampling rate of the generated WAV files - nC: the number of channesl of the ge...
[ "This", "function", "converts", "the", "WAV", "files", "stored", "in", "a", "folder", "to", "WAV", "using", "a", "different", "sampling", "freq", "and", "number", "of", "channels", ".", "ARGUMENTS", ":", "-", "dirName", ":", "the", "path", "of", "the", "...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioBasicIO.py#L40-L64
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioBasicIO.py
readAudioFile
def readAudioFile(path): ''' This function returns a numpy array that stores the audio samples of a specified WAV of AIFF file ''' extension = os.path.splitext(path)[1] try: #if extension.lower() == '.wav': #[Fs, x] = wavfile.read(path) if extension.lower() == '.aif' or ...
python
def readAudioFile(path): ''' This function returns a numpy array that stores the audio samples of a specified WAV of AIFF file ''' extension = os.path.splitext(path)[1] try: #if extension.lower() == '.wav': #[Fs, x] = wavfile.read(path) if extension.lower() == '.aif' or ...
[ "def", "readAudioFile", "(", "path", ")", ":", "extension", "=", "os", ".", "path", ".", "splitext", "(", "path", ")", "[", "1", "]", "try", ":", "#if extension.lower() == '.wav':", "#[Fs, x] = wavfile.read(path)", "if", "extension", ".", "lower", "(", ")", ...
This function returns a numpy array that stores the audio samples of a specified WAV of AIFF file
[ "This", "function", "returns", "a", "numpy", "array", "that", "stores", "the", "audio", "samples", "of", "a", "specified", "WAV", "of", "AIFF", "file" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioBasicIO.py#L66-L112
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioBasicIO.py
stereo2mono
def stereo2mono(x): ''' This function converts the input signal (stored in a numpy array) to MONO (if it is STEREO) ''' if isinstance(x, int): return -1 if x.ndim==1: return x elif x.ndim==2: if x.shape[1]==1: return x.flatten() else: i...
python
def stereo2mono(x): ''' This function converts the input signal (stored in a numpy array) to MONO (if it is STEREO) ''' if isinstance(x, int): return -1 if x.ndim==1: return x elif x.ndim==2: if x.shape[1]==1: return x.flatten() else: i...
[ "def", "stereo2mono", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "int", ")", ":", "return", "-", "1", "if", "x", ".", "ndim", "==", "1", ":", "return", "x", "elif", "x", ".", "ndim", "==", "2", ":", "if", "x", ".", "shape", "[", ...
This function converts the input signal (stored in a numpy array) to MONO (if it is STEREO)
[ "This", "function", "converts", "the", "input", "signal", "(", "stored", "in", "a", "numpy", "array", ")", "to", "MONO", "(", "if", "it", "is", "STEREO", ")" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioBasicIO.py#L114-L130
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
selfSimilarityMatrix
def selfSimilarityMatrix(featureVectors): ''' This function computes the self-similarity matrix for a sequence of feature vectors. ARGUMENTS: - featureVectors: a numpy matrix (nDims x nVectors) whose i-th column corresponds to the i-th feature vector RETURNS: ...
python
def selfSimilarityMatrix(featureVectors): ''' This function computes the self-similarity matrix for a sequence of feature vectors. ARGUMENTS: - featureVectors: a numpy matrix (nDims x nVectors) whose i-th column corresponds to the i-th feature vector RETURNS: ...
[ "def", "selfSimilarityMatrix", "(", "featureVectors", ")", ":", "[", "nDims", ",", "nVectors", "]", "=", "featureVectors", ".", "shape", "[", "featureVectors2", ",", "MEAN", ",", "STD", "]", "=", "aT", ".", "normalizeFeatures", "(", "[", "featureVectors", "....
This function computes the self-similarity matrix for a sequence of feature vectors. ARGUMENTS: - featureVectors: a numpy matrix (nDims x nVectors) whose i-th column corresponds to the i-th feature vector RETURNS: - S: the self-similarity matrix (nV...
[ "This", "function", "computes", "the", "self", "-", "similarity", "matrix", "for", "a", "sequence", "of", "feature", "vectors", ".", "ARGUMENTS", ":", "-", "featureVectors", ":", "a", "numpy", "matrix", "(", "nDims", "x", "nVectors", ")", "whose", "i", "-"...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L38-L54
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
flags2segs
def flags2segs(flags, window): ''' ARGUMENTS: - flags: a sequence of class flags (per time window) - window: window duration (in seconds) RETURNS: - segs: a sequence of segment's limits: segs[i,0] is start and segs[i,1] are start and end point of segment i ...
python
def flags2segs(flags, window): ''' ARGUMENTS: - flags: a sequence of class flags (per time window) - window: window duration (in seconds) RETURNS: - segs: a sequence of segment's limits: segs[i,0] is start and segs[i,1] are start and end point of segment i ...
[ "def", "flags2segs", "(", "flags", ",", "window", ")", ":", "preFlag", "=", "0", "cur_flag", "=", "0", "n_segs", "=", "0", "cur_val", "=", "flags", "[", "cur_flag", "]", "segsList", "=", "[", "]", "classes", "=", "[", "]", "while", "(", "cur_flag", ...
ARGUMENTS: - flags: a sequence of class flags (per time window) - window: window duration (in seconds) RETURNS: - segs: a sequence of segment's limits: segs[i,0] is start and segs[i,1] are start and end point of segment i - classes: a sequence of class flags...
[ "ARGUMENTS", ":", "-", "flags", ":", "a", "sequence", "of", "class", "flags", "(", "per", "time", "window", ")", "-", "window", ":", "window", "duration", "(", "in", "seconds", ")" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L57-L97
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
segs2flags
def segs2flags(seg_start, seg_end, seg_label, win_size): ''' This function converts segment endpoints and respective segment labels to fix-sized class labels. ARGUMENTS: - seg_start: segment start points (in seconds) - seg_end: segment endpoints (in seconds) - seg_label: segment ...
python
def segs2flags(seg_start, seg_end, seg_label, win_size): ''' This function converts segment endpoints and respective segment labels to fix-sized class labels. ARGUMENTS: - seg_start: segment start points (in seconds) - seg_end: segment endpoints (in seconds) - seg_label: segment ...
[ "def", "segs2flags", "(", "seg_start", ",", "seg_end", ",", "seg_label", ",", "win_size", ")", ":", "flags", "=", "[", "]", "class_names", "=", "list", "(", "set", "(", "seg_label", ")", ")", "curPos", "=", "win_size", "/", "2.0", "while", "curPos", "<...
This function converts segment endpoints and respective segment labels to fix-sized class labels. ARGUMENTS: - seg_start: segment start points (in seconds) - seg_end: segment endpoints (in seconds) - seg_label: segment labels - win_size: fix-sized window (in seconds) RETURNS...
[ "This", "function", "converts", "segment", "endpoints", "and", "respective", "segment", "labels", "to", "fix", "-", "sized", "class", "labels", ".", "ARGUMENTS", ":", "-", "seg_start", ":", "segment", "start", "points", "(", "in", "seconds", ")", "-", "seg_e...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L100-L122
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
computePreRec
def computePreRec(cm, class_names): ''' This function computes the precision, recall and f1 measures, given a confusion matrix ''' n_classes = cm.shape[0] if len(class_names) != n_classes: print("Error in computePreRec! Confusion matrix and class_names " "list must be of th...
python
def computePreRec(cm, class_names): ''' This function computes the precision, recall and f1 measures, given a confusion matrix ''' n_classes = cm.shape[0] if len(class_names) != n_classes: print("Error in computePreRec! Confusion matrix and class_names " "list must be of th...
[ "def", "computePreRec", "(", "cm", ",", "class_names", ")", ":", "n_classes", "=", "cm", ".", "shape", "[", "0", "]", "if", "len", "(", "class_names", ")", "!=", "n_classes", ":", "print", "(", "\"Error in computePreRec! Confusion matrix and class_names \"", "\"...
This function computes the precision, recall and f1 measures, given a confusion matrix
[ "This", "function", "computes", "the", "precision", "recall", "and", "f1", "measures", "given", "a", "confusion", "matrix" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L124-L141
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
readSegmentGT
def readSegmentGT(gt_file): ''' This function reads a segmentation ground truth file, following a simple CSV format with the following columns: <segment start>,<segment end>,<class label> ARGUMENTS: - gt_file: the path of the CSV segment file RETURNS: - seg_start: a numpy array ...
python
def readSegmentGT(gt_file): ''' This function reads a segmentation ground truth file, following a simple CSV format with the following columns: <segment start>,<segment end>,<class label> ARGUMENTS: - gt_file: the path of the CSV segment file RETURNS: - seg_start: a numpy array ...
[ "def", "readSegmentGT", "(", "gt_file", ")", ":", "f", "=", "open", "(", "gt_file", ",", "'rt'", ")", "reader", "=", "csv", ".", "reader", "(", "f", ",", "delimiter", "=", "','", ")", "seg_start", "=", "[", "]", "seg_end", "=", "[", "]", "seg_label...
This function reads a segmentation ground truth file, following a simple CSV format with the following columns: <segment start>,<segment end>,<class label> ARGUMENTS: - gt_file: the path of the CSV segment file RETURNS: - seg_start: a numpy array of segments' start positions - seg_...
[ "This", "function", "reads", "a", "segmentation", "ground", "truth", "file", "following", "a", "simple", "CSV", "format", "with", "the", "following", "columns", ":", "<segment", "start", ">", "<segment", "end", ">", "<class", "label", ">" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L144-L170
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
plotSegmentationResults
def plotSegmentationResults(flags_ind, flags_ind_gt, class_names, mt_step, ONLY_EVALUATE=False): ''' This function plots statistics on the classification-segmentation results produced either by the fix-sized supervised method or the HMM method. It also computes the overall accuracy achieved by the respectiv...
python
def plotSegmentationResults(flags_ind, flags_ind_gt, class_names, mt_step, ONLY_EVALUATE=False): ''' This function plots statistics on the classification-segmentation results produced either by the fix-sized supervised method or the HMM method. It also computes the overall accuracy achieved by the respectiv...
[ "def", "plotSegmentationResults", "(", "flags_ind", ",", "flags_ind_gt", ",", "class_names", ",", "mt_step", ",", "ONLY_EVALUATE", "=", "False", ")", ":", "flags", "=", "[", "class_names", "[", "int", "(", "f", ")", "]", "for", "f", "in", "flags_ind", "]",...
This function plots statistics on the classification-segmentation results produced either by the fix-sized supervised method or the HMM method. It also computes the overall accuracy achieved by the respective method if ground-truth is available.
[ "This", "function", "plots", "statistics", "on", "the", "classification", "-", "segmentation", "results", "produced", "either", "by", "the", "fix", "-", "sized", "supervised", "method", "or", "the", "HMM", "method", ".", "It", "also", "computes", "the", "overa...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L173-L240
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
trainHMM_computeStatistics
def trainHMM_computeStatistics(features, labels): ''' This function computes the statistics used to train an HMM joint segmentation-classification model using a sequence of sequential features and respective labels ARGUMENTS: - features: a numpy matrix of feature vectors (numOfDimensions x n_wi...
python
def trainHMM_computeStatistics(features, labels): ''' This function computes the statistics used to train an HMM joint segmentation-classification model using a sequence of sequential features and respective labels ARGUMENTS: - features: a numpy matrix of feature vectors (numOfDimensions x n_wi...
[ "def", "trainHMM_computeStatistics", "(", "features", ",", "labels", ")", ":", "u_labels", "=", "numpy", ".", "unique", "(", "labels", ")", "n_comps", "=", "len", "(", "u_labels", ")", "n_feats", "=", "features", ".", "shape", "[", "0", "]", "if", "featu...
This function computes the statistics used to train an HMM joint segmentation-classification model using a sequence of sequential features and respective labels ARGUMENTS: - features: a numpy matrix of feature vectors (numOfDimensions x n_wins) - labels: a numpy array of class indices (n_wins x...
[ "This", "function", "computes", "the", "statistics", "used", "to", "train", "an", "HMM", "joint", "segmentation", "-", "classification", "model", "using", "a", "sequence", "of", "sequential", "features", "and", "respective", "labels" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L278-L330
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
trainHMM_fromFile
def trainHMM_fromFile(wav_file, gt_file, hmm_model_name, mt_win, mt_step): ''' This function trains a HMM model for segmentation-classification using a single annotated audio file ARGUMENTS: - wav_file: the path of the audio filename - gt_file: the path of the ground truth filename ...
python
def trainHMM_fromFile(wav_file, gt_file, hmm_model_name, mt_win, mt_step): ''' This function trains a HMM model for segmentation-classification using a single annotated audio file ARGUMENTS: - wav_file: the path of the audio filename - gt_file: the path of the ground truth filename ...
[ "def", "trainHMM_fromFile", "(", "wav_file", ",", "gt_file", ",", "hmm_model_name", ",", "mt_win", ",", "mt_step", ")", ":", "[", "seg_start", ",", "seg_end", ",", "seg_labs", "]", "=", "readSegmentGT", "(", "gt_file", ")", "flags", ",", "class_names", "=", ...
This function trains a HMM model for segmentation-classification using a single annotated audio file ARGUMENTS: - wav_file: the path of the audio filename - gt_file: the path of the ground truth filename (a csv file of the form <segment start in seconds>,<segment end ...
[ "This", "function", "trains", "a", "HMM", "model", "for", "segmentation", "-", "classification", "using", "a", "single", "annotated", "audio", "file", "ARGUMENTS", ":", "-", "wav_file", ":", "the", "path", "of", "the", "audio", "filename", "-", "gt_file", ":...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L333-L370
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
trainHMM_fromDir
def trainHMM_fromDir(dirPath, hmm_model_name, mt_win, mt_step): ''' This function trains a HMM model for segmentation-classification using a where WAV files and .segment (ground-truth files) are stored ARGUMENTS: - dirPath: the path of the data diretory - hmm_model_name: the name of ...
python
def trainHMM_fromDir(dirPath, hmm_model_name, mt_win, mt_step): ''' This function trains a HMM model for segmentation-classification using a where WAV files and .segment (ground-truth files) are stored ARGUMENTS: - dirPath: the path of the data diretory - hmm_model_name: the name of ...
[ "def", "trainHMM_fromDir", "(", "dirPath", ",", "hmm_model_name", ",", "mt_win", ",", "mt_step", ")", ":", "flags_all", "=", "numpy", ".", "array", "(", "[", "]", ")", "classes_all", "=", "[", "]", "for", "i", ",", "f", "in", "enumerate", "(", "glob", ...
This function trains a HMM model for segmentation-classification using a where WAV files and .segment (ground-truth files) are stored ARGUMENTS: - dirPath: the path of the data diretory - hmm_model_name: the name of the HMM model to be stored - mt_win: mid-term window size -...
[ "This", "function", "trains", "a", "HMM", "model", "for", "segmentation", "-", "classification", "using", "a", "where", "WAV", "files", "and", ".", "segment", "(", "ground", "-", "truth", "files", ")", "are", "stored", "ARGUMENTS", ":", "-", "dirPath", ":"...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L373-L439
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
mtFileClassification
def mtFileClassification(input_file, model_name, model_type, plot_results=False, gt_file=""): ''' This function performs mid-term classification of an audio stream. Towards this end, supervised knowledge is used, i.e. a pre-trained classifier. ARGUMENTS: - input_file: ...
python
def mtFileClassification(input_file, model_name, model_type, plot_results=False, gt_file=""): ''' This function performs mid-term classification of an audio stream. Towards this end, supervised knowledge is used, i.e. a pre-trained classifier. ARGUMENTS: - input_file: ...
[ "def", "mtFileClassification", "(", "input_file", ",", "model_name", ",", "model_type", ",", "plot_results", "=", "False", ",", "gt_file", "=", "\"\"", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "model_name", ")", ":", "print", "(", "\...
This function performs mid-term classification of an audio stream. Towards this end, supervised knowledge is used, i.e. a pre-trained classifier. ARGUMENTS: - input_file: path of the input WAV file - model_name: name of the classification model - model_type: svm or k...
[ "This", "function", "performs", "mid", "-", "term", "classification", "of", "an", "audio", "stream", ".", "Towards", "this", "end", "supervised", "knowledge", "is", "used", "i", ".", "e", ".", "a", "pre", "-", "trained", "classifier", ".", "ARGUMENTS", ":"...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L491-L579
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
silenceRemoval
def silenceRemoval(x, fs, st_win, st_step, smoothWindow=0.5, weight=0.5, plot=False): ''' Event Detection (silence removal) ARGUMENTS: - x: the input audio signal - fs: sampling freq - st_win, st_step: window size and step in seconds - smoo...
python
def silenceRemoval(x, fs, st_win, st_step, smoothWindow=0.5, weight=0.5, plot=False): ''' Event Detection (silence removal) ARGUMENTS: - x: the input audio signal - fs: sampling freq - st_win, st_step: window size and step in seconds - smoo...
[ "def", "silenceRemoval", "(", "x", ",", "fs", ",", "st_win", ",", "st_step", ",", "smoothWindow", "=", "0.5", ",", "weight", "=", "0.5", ",", "plot", "=", "False", ")", ":", "if", "weight", ">=", "1", ":", "weight", "=", "0.99", "if", "weight", "<=...
Event Detection (silence removal) ARGUMENTS: - x: the input audio signal - fs: sampling freq - st_win, st_step: window size and step in seconds - smoothWindow: (optinal) smooth window (in seconds) - weight: (optinal) weight f...
[ "Event", "Detection", "(", "silence", "removal", ")", "ARGUMENTS", ":", "-", "x", ":", "the", "input", "audio", "signal", "-", "fs", ":", "sampling", "freq", "-", "st_win", "st_step", ":", "window", "size", "and", "step", "in", "seconds", "-", "smoothWin...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L625-L738
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
speakerDiarization
def speakerDiarization(filename, n_speakers, mt_size=2.0, mt_step=0.2, st_win=0.05, lda_dim=35, plot_res=False): ''' ARGUMENTS: - filename: the name of the WAV file to be analyzed - n_speakers the number of speakers (clusters) in the recording (<=0 for unknown) ...
python
def speakerDiarization(filename, n_speakers, mt_size=2.0, mt_step=0.2, st_win=0.05, lda_dim=35, plot_res=False): ''' ARGUMENTS: - filename: the name of the WAV file to be analyzed - n_speakers the number of speakers (clusters) in the recording (<=0 for unknown) ...
[ "def", "speakerDiarization", "(", "filename", ",", "n_speakers", ",", "mt_size", "=", "2.0", ",", "mt_step", "=", "0.2", ",", "st_win", "=", "0.05", ",", "lda_dim", "=", "35", ",", "plot_res", "=", "False", ")", ":", "[", "fs", ",", "x", "]", "=", ...
ARGUMENTS: - filename: the name of the WAV file to be analyzed - n_speakers the number of speakers (clusters) in the recording (<=0 for unknown) - mt_size (opt) mid-term window size - mt_step (opt) mid-term window step - st_win (opt) short-term window size ...
[ "ARGUMENTS", ":", "-", "filename", ":", "the", "name", "of", "the", "WAV", "file", "to", "be", "analyzed", "-", "n_speakers", "the", "number", "of", "speakers", "(", "clusters", ")", "in", "the", "recording", "(", "<", "=", "0", "for", "unknown", ")", ...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L741-L988
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
speakerDiarizationEvaluateScript
def speakerDiarizationEvaluateScript(folder_name, ldas): ''' This function prints the cluster purity and speaker purity for each WAV file stored in a provided directory (.SEGMENT files are needed as ground-truth) ARGUMENTS: - folder_name: the full path of the folder ...
python
def speakerDiarizationEvaluateScript(folder_name, ldas): ''' This function prints the cluster purity and speaker purity for each WAV file stored in a provided directory (.SEGMENT files are needed as ground-truth) ARGUMENTS: - folder_name: the full path of the folder ...
[ "def", "speakerDiarizationEvaluateScript", "(", "folder_name", ",", "ldas", ")", ":", "types", "=", "(", "'*.wav'", ",", ")", "wavFilesList", "=", "[", "]", "for", "files", "in", "types", ":", "wavFilesList", ".", "extend", "(", "glob", ".", "glob", "(", ...
This function prints the cluster purity and speaker purity for each WAV file stored in a provided directory (.SEGMENT files are needed as ground-truth) ARGUMENTS: - folder_name: the full path of the folder where the WAV and SEGMENT (ground-truth) fi...
[ "This", "function", "prints", "the", "cluster", "purity", "and", "speaker", "purity", "for", "each", "WAV", "file", "stored", "in", "a", "provided", "directory", "(", ".", "SEGMENT", "files", "are", "needed", "as", "ground", "-", "truth", ")", "ARGUMENTS", ...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L990-L1021
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
musicThumbnailing
def musicThumbnailing(x, fs, short_term_size=1.0, short_term_step=0.5, thumb_size=10.0, limit_1 = 0, limit_2 = 1): ''' This function detects instances of the most representative part of a music recording, also called "music thumbnails". A technique similar to the one proposed in [...
python
def musicThumbnailing(x, fs, short_term_size=1.0, short_term_step=0.5, thumb_size=10.0, limit_1 = 0, limit_2 = 1): ''' This function detects instances of the most representative part of a music recording, also called "music thumbnails". A technique similar to the one proposed in [...
[ "def", "musicThumbnailing", "(", "x", ",", "fs", ",", "short_term_size", "=", "1.0", ",", "short_term_step", "=", "0.5", ",", "thumb_size", "=", "10.0", ",", "limit_1", "=", "0", ",", "limit_2", "=", "1", ")", ":", "x", "=", "audioBasicIO", ".", "stere...
This function detects instances of the most representative part of a music recording, also called "music thumbnails". A technique similar to the one proposed in [1], however a wider set of audio features is used instead of chroma features. In particular the following steps are followed: - Extract s...
[ "This", "function", "detects", "instances", "of", "the", "most", "representative", "part", "of", "a", "music", "recording", "also", "called", "music", "thumbnails", ".", "A", "technique", "similar", "to", "the", "one", "proposed", "in", "[", "1", "]", "howev...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L1023-L1109
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
generateColorMap
def generateColorMap(): ''' This function generates a 256 jet colormap of HTML-like hex string colors (e.g. FF88AA) ''' Map = cm.jet(np.arange(256)) stringColors = [] for i in range(Map.shape[0]): rgb = (int(255*Map[i][0]), int(255*Map[i][1]), int(255*Map[i][2])) if (sys.vers...
python
def generateColorMap(): ''' This function generates a 256 jet colormap of HTML-like hex string colors (e.g. FF88AA) ''' Map = cm.jet(np.arange(256)) stringColors = [] for i in range(Map.shape[0]): rgb = (int(255*Map[i][0]), int(255*Map[i][1]), int(255*Map[i][2])) if (sys.vers...
[ "def", "generateColorMap", "(", ")", ":", "Map", "=", "cm", ".", "jet", "(", "np", ".", "arange", "(", "256", ")", ")", "stringColors", "=", "[", "]", "for", "i", "in", "range", "(", "Map", ".", "shape", "[", "0", "]", ")", ":", "rgb", "=", "...
This function generates a 256 jet colormap of HTML-like hex string colors (e.g. FF88AA)
[ "This", "function", "generates", "a", "256", "jet", "colormap", "of", "HTML", "-", "like", "hex", "string", "colors", "(", "e", ".", "g", ".", "FF88AA", ")" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L14-L29
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
levenshtein
def levenshtein(str1, s2): ''' Distance between two strings ''' N1 = len(str1) N2 = len(s2) stringRange = [range(N1 + 1)] * (N2 + 1) for i in range(N2 + 1): stringRange[i] = range(i,i + N1 + 1) for i in range(0,N2): for j in range(0,N1): if str1[j] == s2[i]: ...
python
def levenshtein(str1, s2): ''' Distance between two strings ''' N1 = len(str1) N2 = len(s2) stringRange = [range(N1 + 1)] * (N2 + 1) for i in range(N2 + 1): stringRange[i] = range(i,i + N1 + 1) for i in range(0,N2): for j in range(0,N1): if str1[j] == s2[i]: ...
[ "def", "levenshtein", "(", "str1", ",", "s2", ")", ":", "N1", "=", "len", "(", "str1", ")", "N2", "=", "len", "(", "s2", ")", "stringRange", "=", "[", "range", "(", "N1", "+", "1", ")", "]", "*", "(", "N2", "+", "1", ")", "for", "i", "in", ...
Distance between two strings
[ "Distance", "between", "two", "strings" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L32-L52
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
text_list_to_colors
def text_list_to_colors(names): ''' Generates a list of colors based on a list of names (strings). Similar strings correspond to similar colors. ''' # STEP A: compute strings distance between all combnations of strings Dnames = np.zeros( (len(names), len(names)) ) for i in range(len(names)): ...
python
def text_list_to_colors(names): ''' Generates a list of colors based on a list of names (strings). Similar strings correspond to similar colors. ''' # STEP A: compute strings distance between all combnations of strings Dnames = np.zeros( (len(names), len(names)) ) for i in range(len(names)): ...
[ "def", "text_list_to_colors", "(", "names", ")", ":", "# STEP A: compute strings distance between all combnations of strings", "Dnames", "=", "np", ".", "zeros", "(", "(", "len", "(", "names", ")", ",", "len", "(", "names", ")", ")", ")", "for", "i", "in", "ra...
Generates a list of colors based on a list of names (strings). Similar strings correspond to similar colors.
[ "Generates", "a", "list", "of", "colors", "based", "on", "a", "list", "of", "names", "(", "strings", ")", ".", "Similar", "strings", "correspond", "to", "similar", "colors", "." ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L55-L74
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
text_list_to_colors_simple
def text_list_to_colors_simple(names): ''' Generates a list of colors based on a list of names (strings). Similar strings correspond to similar colors. ''' uNames = list(set(names)) uNames.sort() textToColor = [ uNames.index(n) for n in names ] textToColor = np.array(textToColor) textTo...
python
def text_list_to_colors_simple(names): ''' Generates a list of colors based on a list of names (strings). Similar strings correspond to similar colors. ''' uNames = list(set(names)) uNames.sort() textToColor = [ uNames.index(n) for n in names ] textToColor = np.array(textToColor) textTo...
[ "def", "text_list_to_colors_simple", "(", "names", ")", ":", "uNames", "=", "list", "(", "set", "(", "names", ")", ")", "uNames", ".", "sort", "(", ")", "textToColor", "=", "[", "uNames", ".", "index", "(", "n", ")", "for", "n", "in", "names", "]", ...
Generates a list of colors based on a list of names (strings). Similar strings correspond to similar colors.
[ "Generates", "a", "list", "of", "colors", "based", "on", "a", "list", "of", "names", "(", "strings", ")", ".", "Similar", "strings", "correspond", "to", "similar", "colors", "." ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L77-L89
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
chordialDiagram
def chordialDiagram(fileStr, SM, Threshold, names, namesCategories): ''' Generates a d3js chordial diagram that illustrates similarites ''' colors = text_list_to_colors_simple(namesCategories) SM2 = SM.copy() SM2 = (SM2 + SM2.T) / 2.0 for i in range(SM2.shape[0]): M = Threshold # ...
python
def chordialDiagram(fileStr, SM, Threshold, names, namesCategories): ''' Generates a d3js chordial diagram that illustrates similarites ''' colors = text_list_to_colors_simple(namesCategories) SM2 = SM.copy() SM2 = (SM2 + SM2.T) / 2.0 for i in range(SM2.shape[0]): M = Threshold # ...
[ "def", "chordialDiagram", "(", "fileStr", ",", "SM", ",", "Threshold", ",", "names", ",", "namesCategories", ")", ":", "colors", "=", "text_list_to_colors_simple", "(", "namesCategories", ")", "SM2", "=", "SM", ".", "copy", "(", ")", "SM2", "=", "(", "SM2"...
Generates a d3js chordial diagram that illustrates similarites
[ "Generates", "a", "d3js", "chordial", "diagram", "that", "illustrates", "similarites" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L92-L123
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
visualizeFeaturesFolder
def visualizeFeaturesFolder(folder, dimReductionMethod, priorKnowledge = "none"): ''' This function generates a chordial visualization for the recordings of the provided path. ARGUMENTS: - folder: path of the folder that contains the WAV files to be processed - dimReductionMethod: ...
python
def visualizeFeaturesFolder(folder, dimReductionMethod, priorKnowledge = "none"): ''' This function generates a chordial visualization for the recordings of the provided path. ARGUMENTS: - folder: path of the folder that contains the WAV files to be processed - dimReductionMethod: ...
[ "def", "visualizeFeaturesFolder", "(", "folder", ",", "dimReductionMethod", ",", "priorKnowledge", "=", "\"none\"", ")", ":", "if", "dimReductionMethod", "==", "\"pca\"", ":", "allMtFeatures", ",", "wavFilesList", ",", "_", "=", "aF", ".", "dirWavFeatureExtraction",...
This function generates a chordial visualization for the recordings of the provided path. ARGUMENTS: - folder: path of the folder that contains the WAV files to be processed - dimReductionMethod: method used to reduce the dimension of the initial feature space before computing the similari...
[ "This", "function", "generates", "a", "chordial", "visualization", "for", "the", "recordings", "of", "the", "provided", "path", ".", "ARGUMENTS", ":", "-", "folder", ":", "path", "of", "the", "folder", "that", "contains", "the", "WAV", "files", "to", "be", ...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L126-L232
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stZCR
def stZCR(frame): """Computes zero crossing rate of frame""" count = len(frame) countZ = numpy.sum(numpy.abs(numpy.diff(numpy.sign(frame)))) / 2 return (numpy.float64(countZ) / numpy.float64(count-1.0))
python
def stZCR(frame): """Computes zero crossing rate of frame""" count = len(frame) countZ = numpy.sum(numpy.abs(numpy.diff(numpy.sign(frame)))) / 2 return (numpy.float64(countZ) / numpy.float64(count-1.0))
[ "def", "stZCR", "(", "frame", ")", ":", "count", "=", "len", "(", "frame", ")", "countZ", "=", "numpy", ".", "sum", "(", "numpy", ".", "abs", "(", "numpy", ".", "diff", "(", "numpy", ".", "sign", "(", "frame", ")", ")", ")", ")", "/", "2", "r...
Computes zero crossing rate of frame
[ "Computes", "zero", "crossing", "rate", "of", "frame" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L19-L23
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stEnergyEntropy
def stEnergyEntropy(frame, n_short_blocks=10): """Computes entropy of energy""" Eol = numpy.sum(frame ** 2) # total frame energy L = len(frame) sub_win_len = int(numpy.floor(L / n_short_blocks)) if L != sub_win_len * n_short_blocks: frame = frame[0:sub_win_len * n_short_blocks] # ...
python
def stEnergyEntropy(frame, n_short_blocks=10): """Computes entropy of energy""" Eol = numpy.sum(frame ** 2) # total frame energy L = len(frame) sub_win_len = int(numpy.floor(L / n_short_blocks)) if L != sub_win_len * n_short_blocks: frame = frame[0:sub_win_len * n_short_blocks] # ...
[ "def", "stEnergyEntropy", "(", "frame", ",", "n_short_blocks", "=", "10", ")", ":", "Eol", "=", "numpy", ".", "sum", "(", "frame", "**", "2", ")", "# total frame energy", "L", "=", "len", "(", "frame", ")", "sub_win_len", "=", "int", "(", "numpy", ".",...
Computes entropy of energy
[ "Computes", "entropy", "of", "energy" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L31-L46
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectralCentroidAndSpread
def stSpectralCentroidAndSpread(X, fs): """Computes spectral centroid of frame (given abs(FFT))""" ind = (numpy.arange(1, len(X) + 1)) * (fs/(2.0 * len(X))) Xt = X.copy() Xt = Xt / Xt.max() NUM = numpy.sum(ind * Xt) DEN = numpy.sum(Xt) + eps # Centroid: C = (NUM / DEN) # Spread: ...
python
def stSpectralCentroidAndSpread(X, fs): """Computes spectral centroid of frame (given abs(FFT))""" ind = (numpy.arange(1, len(X) + 1)) * (fs/(2.0 * len(X))) Xt = X.copy() Xt = Xt / Xt.max() NUM = numpy.sum(ind * Xt) DEN = numpy.sum(Xt) + eps # Centroid: C = (NUM / DEN) # Spread: ...
[ "def", "stSpectralCentroidAndSpread", "(", "X", ",", "fs", ")", ":", "ind", "=", "(", "numpy", ".", "arange", "(", "1", ",", "len", "(", "X", ")", "+", "1", ")", ")", "*", "(", "fs", "/", "(", "2.0", "*", "len", "(", "X", ")", ")", ")", "Xt...
Computes spectral centroid of frame (given abs(FFT))
[ "Computes", "spectral", "centroid", "of", "frame", "(", "given", "abs", "(", "FFT", "))" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L52-L71
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectralEntropy
def stSpectralEntropy(X, n_short_blocks=10): """Computes the spectral entropy""" L = len(X) # number of frame samples Eol = numpy.sum(X ** 2) # total spectral energy sub_win_len = int(numpy.floor(L / n_short_blocks)) # length of sub-frame if L != sub_win_len * n...
python
def stSpectralEntropy(X, n_short_blocks=10): """Computes the spectral entropy""" L = len(X) # number of frame samples Eol = numpy.sum(X ** 2) # total spectral energy sub_win_len = int(numpy.floor(L / n_short_blocks)) # length of sub-frame if L != sub_win_len * n...
[ "def", "stSpectralEntropy", "(", "X", ",", "n_short_blocks", "=", "10", ")", ":", "L", "=", "len", "(", "X", ")", "# number of frame samples", "Eol", "=", "numpy", ".", "sum", "(", "X", "**", "2", ")", "# total spectral energy", "sub_win_len", "=", "int", ...
Computes the spectral entropy
[ "Computes", "the", "spectral", "entropy" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L74-L87
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectralFlux
def stSpectralFlux(X, X_prev): """ Computes the spectral flux feature of the current frame ARGUMENTS: X: the abs(fft) of the current frame X_prev: the abs(fft) of the previous frame """ # compute the spectral flux as the sum of square distances: sumX = numpy.sum...
python
def stSpectralFlux(X, X_prev): """ Computes the spectral flux feature of the current frame ARGUMENTS: X: the abs(fft) of the current frame X_prev: the abs(fft) of the previous frame """ # compute the spectral flux as the sum of square distances: sumX = numpy.sum...
[ "def", "stSpectralFlux", "(", "X", ",", "X_prev", ")", ":", "# compute the spectral flux as the sum of square distances:", "sumX", "=", "numpy", ".", "sum", "(", "X", "+", "eps", ")", "sumPrevX", "=", "numpy", ".", "sum", "(", "X_prev", "+", "eps", ")", "F",...
Computes the spectral flux feature of the current frame ARGUMENTS: X: the abs(fft) of the current frame X_prev: the abs(fft) of the previous frame
[ "Computes", "the", "spectral", "flux", "feature", "of", "the", "current", "frame", "ARGUMENTS", ":", "X", ":", "the", "abs", "(", "fft", ")", "of", "the", "current", "frame", "X_prev", ":", "the", "abs", "(", "fft", ")", "of", "the", "previous", "frame...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L90-L102
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectralRollOff
def stSpectralRollOff(X, c, fs): """Computes spectral roll-off""" totalEnergy = numpy.sum(X ** 2) fftLength = len(X) Thres = c*totalEnergy # Ffind the spectral rolloff as the frequency position # where the respective spectral energy is equal to c*totalEnergy CumSum = numpy.cumsum(X ** 2) + ...
python
def stSpectralRollOff(X, c, fs): """Computes spectral roll-off""" totalEnergy = numpy.sum(X ** 2) fftLength = len(X) Thres = c*totalEnergy # Ffind the spectral rolloff as the frequency position # where the respective spectral energy is equal to c*totalEnergy CumSum = numpy.cumsum(X ** 2) + ...
[ "def", "stSpectralRollOff", "(", "X", ",", "c", ",", "fs", ")", ":", "totalEnergy", "=", "numpy", ".", "sum", "(", "X", "**", "2", ")", "fftLength", "=", "len", "(", "X", ")", "Thres", "=", "c", "*", "totalEnergy", "# Ffind the spectral rolloff as the fr...
Computes spectral roll-off
[ "Computes", "spectral", "roll", "-", "off" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L105-L118
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stHarmonic
def stHarmonic(frame, fs): """ Computes harmonic ratio and pitch """ M = numpy.round(0.016 * fs) - 1 R = numpy.correlate(frame, frame, mode='full') g = R[len(frame)-1] R = R[len(frame):-1] # estimate m0 (as the first zero crossing of R) [a, ] = numpy.nonzero(numpy.diff(numpy.sign(R...
python
def stHarmonic(frame, fs): """ Computes harmonic ratio and pitch """ M = numpy.round(0.016 * fs) - 1 R = numpy.correlate(frame, frame, mode='full') g = R[len(frame)-1] R = R[len(frame):-1] # estimate m0 (as the first zero crossing of R) [a, ] = numpy.nonzero(numpy.diff(numpy.sign(R...
[ "def", "stHarmonic", "(", "frame", ",", "fs", ")", ":", "M", "=", "numpy", ".", "round", "(", "0.016", "*", "fs", ")", "-", "1", "R", "=", "numpy", ".", "correlate", "(", "frame", ",", "frame", ",", "mode", "=", "'full'", ")", "g", "=", "R", ...
Computes harmonic ratio and pitch
[ "Computes", "harmonic", "ratio", "and", "pitch" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L121-L166
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
mfccInitFilterBanks
def mfccInitFilterBanks(fs, nfft): """ Computes the triangular filterbank for MFCC computation (used in the stFeatureExtraction function before the stMFCC function call) This function is taken from the scikits.talkbox library (MIT Licence): https://pypi.python.org/pypi/scikits.talkbox """ ...
python
def mfccInitFilterBanks(fs, nfft): """ Computes the triangular filterbank for MFCC computation (used in the stFeatureExtraction function before the stMFCC function call) This function is taken from the scikits.talkbox library (MIT Licence): https://pypi.python.org/pypi/scikits.talkbox """ ...
[ "def", "mfccInitFilterBanks", "(", "fs", ",", "nfft", ")", ":", "# filter bank params:", "lowfreq", "=", "133.33", "linsc", "=", "200", "/", "3.", "logsc", "=", "1.0711703", "numLinFiltTotal", "=", "13", "numLogFilt", "=", "27", "if", "fs", "<", "8000", ":...
Computes the triangular filterbank for MFCC computation (used in the stFeatureExtraction function before the stMFCC function call) This function is taken from the scikits.talkbox library (MIT Licence): https://pypi.python.org/pypi/scikits.talkbox
[ "Computes", "the", "triangular", "filterbank", "for", "MFCC", "computation", "(", "used", "in", "the", "stFeatureExtraction", "function", "before", "the", "stMFCC", "function", "call", ")", "This", "function", "is", "taken", "from", "the", "scikits", ".", "talkb...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L169-L216
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stMFCC
def stMFCC(X, fbank, n_mfcc_feats): """ Computes the MFCCs of a frame, given the fft mag ARGUMENTS: X: fft magnitude abs(FFT) fbank: filter bank (see mfccInitFilterBanks) RETURN ceps: MFCCs (13 element vector) Note: MFCC calculation is, in general, taken fr...
python
def stMFCC(X, fbank, n_mfcc_feats): """ Computes the MFCCs of a frame, given the fft mag ARGUMENTS: X: fft magnitude abs(FFT) fbank: filter bank (see mfccInitFilterBanks) RETURN ceps: MFCCs (13 element vector) Note: MFCC calculation is, in general, taken fr...
[ "def", "stMFCC", "(", "X", ",", "fbank", ",", "n_mfcc_feats", ")", ":", "mspec", "=", "numpy", ".", "log10", "(", "numpy", ".", "dot", "(", "X", ",", "fbank", ".", "T", ")", "+", "eps", ")", "ceps", "=", "dct", "(", "mspec", ",", "type", "=", ...
Computes the MFCCs of a frame, given the fft mag ARGUMENTS: X: fft magnitude abs(FFT) fbank: filter bank (see mfccInitFilterBanks) RETURN ceps: MFCCs (13 element vector) Note: MFCC calculation is, in general, taken from the scikits.talkbox library (MI...
[ "Computes", "the", "MFCCs", "of", "a", "frame", "given", "the", "fft", "mag" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L219-L237
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stChromaFeaturesInit
def stChromaFeaturesInit(nfft, fs): """ This function initializes the chroma matrices used in the calculation of the chroma features """ freqs = numpy.array([((f + 1) * fs) / (2 * nfft) for f in range(nfft)]) Cp = 27.50 nChroma = numpy.round(12.0 * numpy.log2(freqs / Cp)).astype(int) ...
python
def stChromaFeaturesInit(nfft, fs): """ This function initializes the chroma matrices used in the calculation of the chroma features """ freqs = numpy.array([((f + 1) * fs) / (2 * nfft) for f in range(nfft)]) Cp = 27.50 nChroma = numpy.round(12.0 * numpy.log2(freqs / Cp)).astype(int) ...
[ "def", "stChromaFeaturesInit", "(", "nfft", ",", "fs", ")", ":", "freqs", "=", "numpy", ".", "array", "(", "[", "(", "(", "f", "+", "1", ")", "*", "fs", ")", "/", "(", "2", "*", "nfft", ")", "for", "f", "in", "range", "(", "nfft", ")", "]", ...
This function initializes the chroma matrices used in the calculation of the chroma features
[ "This", "function", "initializes", "the", "chroma", "matrices", "used", "in", "the", "calculation", "of", "the", "chroma", "features" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L240-L255
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stChromagram
def stChromagram(signal, fs, win, step, PLOT=False): """ Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term...
python
def stChromagram(signal, fs, win, step, PLOT=False): """ Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term...
[ "def", "stChromagram", "(", "signal", ",", "fs", ",", "win", ",", "step", ",", "PLOT", "=", "False", ")", ":", "win", "=", "int", "(", "win", ")", "step", "=", "int", "(", "step", ")", "signal", "=", "numpy", ".", "double", "(", "signal", ")", ...
Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term window size (in samples) step: the short-term win...
[ "Short", "-", "term", "FFT", "mag", "for", "spectogram", "estimation", ":", "Returns", ":", "a", "numpy", "array", "(", "nFFT", "x", "numOfShortTermWindows", ")", "ARGUMENTS", ":", "signal", ":", "the", "input", "signal", "samples", "fs", ":", "the", "samp...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L298-L365
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
beatExtraction
def beatExtraction(st_features, win_len, PLOT=False): """ This function extracts an estimate of the beat rate for a musical signal. ARGUMENTS: - st_features: a numpy array (n_feats x numOfShortTermWindows) - win_len: window size in seconds RETURNS: - BPM: estimates o...
python
def beatExtraction(st_features, win_len, PLOT=False): """ This function extracts an estimate of the beat rate for a musical signal. ARGUMENTS: - st_features: a numpy array (n_feats x numOfShortTermWindows) - win_len: window size in seconds RETURNS: - BPM: estimates o...
[ "def", "beatExtraction", "(", "st_features", ",", "win_len", ",", "PLOT", "=", "False", ")", ":", "# Features that are related to the beat tracking task:", "toWatch", "=", "[", "0", ",", "1", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",", "8", ",...
This function extracts an estimate of the beat rate for a musical signal. ARGUMENTS: - st_features: a numpy array (n_feats x numOfShortTermWindows) - win_len: window size in seconds RETURNS: - BPM: estimates of beats per minute - Ratio: a confidence measure
[ "This", "function", "extracts", "an", "estimate", "of", "the", "beat", "rate", "for", "a", "musical", "signal", ".", "ARGUMENTS", ":", "-", "st_features", ":", "a", "numpy", "array", "(", "n_feats", "x", "numOfShortTermWindows", ")", "-", "win_len", ":", "...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L392-L450
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stSpectogram
def stSpectogram(signal, fs, win, step, PLOT=False): """ Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term...
python
def stSpectogram(signal, fs, win, step, PLOT=False): """ Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term...
[ "def", "stSpectogram", "(", "signal", ",", "fs", ",", "win", ",", "step", ",", "PLOT", "=", "False", ")", ":", "win", "=", "int", "(", "win", ")", "step", "=", "int", "(", "step", ")", "signal", "=", "numpy", ".", "double", "(", "signal", ")", ...
Short-term FFT mag for spectogram estimation: Returns: a numpy array (nFFT x numOfShortTermWindows) ARGUMENTS: signal: the input signal samples fs: the sampling freq (in Hz) win: the short-term window size (in samples) step: the short-term win...
[ "Short", "-", "term", "FFT", "mag", "for", "spectogram", "estimation", ":", "Returns", ":", "a", "numpy", "array", "(", "nFFT", "x", "numOfShortTermWindows", ")", "ARGUMENTS", ":", "signal", ":", "the", "input", "signal", "samples", "fs", ":", "the", "samp...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L453-L515
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stFeatureExtraction
def stFeatureExtraction(signal, fs, win, step): """ This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples ...
python
def stFeatureExtraction(signal, fs, win, step): """ This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples ...
[ "def", "stFeatureExtraction", "(", "signal", ",", "fs", ",", "win", ",", "step", ")", ":", "win", "=", "int", "(", "win", ")", "step", "=", "int", "(", "step", ")", "# Signal normalization", "signal", "=", "numpy", ".", "double", "(", "signal", ")", ...
This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples fs: the sampling freq (in Hz) win: ...
[ "This", "function", "implements", "the", "shor", "-", "term", "windowing", "process", ".", "For", "each", "short", "-", "term", "window", "a", "set", "of", "features", "is", "extracted", ".", "This", "results", "to", "a", "sequence", "of", "feature", "vect...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L521-L614
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
mtFeatureExtraction
def mtFeatureExtraction(signal, fs, mt_win, mt_step, st_win, st_step): """ Mid-term feature extraction """ mt_win_ratio = int(round(mt_win / st_step)) mt_step_ratio = int(round(mt_step / st_step)) mt_features = [] st_features, f_names = stFeatureExtraction(signal, fs, st_win, st_step) ...
python
def mtFeatureExtraction(signal, fs, mt_win, mt_step, st_win, st_step): """ Mid-term feature extraction """ mt_win_ratio = int(round(mt_win / st_step)) mt_step_ratio = int(round(mt_step / st_step)) mt_features = [] st_features, f_names = stFeatureExtraction(signal, fs, st_win, st_step) ...
[ "def", "mtFeatureExtraction", "(", "signal", ",", "fs", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ")", ":", "mt_win_ratio", "=", "int", "(", "round", "(", "mt_win", "/", "st_step", ")", ")", "mt_step_ratio", "=", "int", "(", "round", ...
Mid-term feature extraction
[ "Mid", "-", "term", "feature", "extraction" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L617-L654
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
dirWavFeatureExtraction
def dirWavFeatureExtraction(dirName, mt_win, mt_step, st_win, st_step, compute_beat=False): """ This function extracts the mid-term features of the WAVE files of a particular folder. The resulting feature vector is extracted by long-term averaging the mid-term features. Ther...
python
def dirWavFeatureExtraction(dirName, mt_win, mt_step, st_win, st_step, compute_beat=False): """ This function extracts the mid-term features of the WAVE files of a particular folder. The resulting feature vector is extracted by long-term averaging the mid-term features. Ther...
[ "def", "dirWavFeatureExtraction", "(", "dirName", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ",", "compute_beat", "=", "False", ")", ":", "all_mt_feats", "=", "numpy", ".", "array", "(", "[", "]", ")", "process_times", "=", "[", "]", "...
This function extracts the mid-term features of the WAVE files of a particular folder. The resulting feature vector is extracted by long-term averaging the mid-term features. Therefore ONE FEATURE VECTOR is extracted for each WAV file. ARGUMENTS: - dirName: the path of the WAVE directory ...
[ "This", "function", "extracts", "the", "mid", "-", "term", "features", "of", "the", "WAVE", "files", "of", "a", "particular", "folder", "." ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L726-L799
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
dirsWavFeatureExtraction
def dirsWavFeatureExtraction(dirNames, mt_win, mt_step, st_win, st_step, compute_beat=False): ''' Same as dirWavFeatureExtraction, but instead of a single dir it takes a list of paths as input and returns a list of feature matrices. EXAMPLE: [features, classNames] = a.dirsWavFeatureExtrac...
python
def dirsWavFeatureExtraction(dirNames, mt_win, mt_step, st_win, st_step, compute_beat=False): ''' Same as dirWavFeatureExtraction, but instead of a single dir it takes a list of paths as input and returns a list of feature matrices. EXAMPLE: [features, classNames] = a.dirsWavFeatureExtrac...
[ "def", "dirsWavFeatureExtraction", "(", "dirNames", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ",", "compute_beat", "=", "False", ")", ":", "# feature extraction for each class:", "features", "=", "[", "]", "classNames", "=", "[", "]", "fileNa...
Same as dirWavFeatureExtraction, but instead of a single dir it takes a list of paths as input and returns a list of feature matrices. EXAMPLE: [features, classNames] = a.dirsWavFeatureExtraction(['audioData/classSegmentsRec/noise','audioData/classSegmentsRec/speech', ...
[ "Same", "as", "dirWavFeatureExtraction", "but", "instead", "of", "a", "single", "dir", "it", "takes", "a", "list", "of", "paths", "as", "input", "and", "returns", "a", "list", "of", "feature", "matrices", ".", "EXAMPLE", ":", "[", "features", "classNames", ...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L802-L831
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
dirWavFeatureExtractionNoAveraging
def dirWavFeatureExtractionNoAveraging(dirName, mt_win, mt_step, st_win, st_step): """ This function extracts the mid-term features of the WAVE files of a particular folder without averaging each file. ARGUMENTS: - dirName: the path of the WAVE directory - mt_win, mt_step: m...
python
def dirWavFeatureExtractionNoAveraging(dirName, mt_win, mt_step, st_win, st_step): """ This function extracts the mid-term features of the WAVE files of a particular folder without averaging each file. ARGUMENTS: - dirName: the path of the WAVE directory - mt_win, mt_step: m...
[ "def", "dirWavFeatureExtractionNoAveraging", "(", "dirName", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ")", ":", "all_mt_feats", "=", "numpy", ".", "array", "(", "[", "]", ")", "signal_idx", "=", "numpy", ".", "array", "(", "[", "]", ...
This function extracts the mid-term features of the WAVE files of a particular folder without averaging each file. ARGUMENTS: - dirName: the path of the WAVE directory - mt_win, mt_step: mid-term window and step (in seconds) - st_win, st_step: short-term window and step (...
[ "This", "function", "extracts", "the", "mid", "-", "term", "features", "of", "the", "WAVE", "files", "of", "a", "particular", "folder", "without", "averaging", "each", "file", "." ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L834-L879
train
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
mtFeatureExtractionToFile
def mtFeatureExtractionToFile(fileName, midTermSize, midTermStep, shortTermSize, shortTermStep, outPutFile, storeStFeatures=False, storeToCSV=False, PLOT=False): """ This function is used as a wrapper to: a) read the content of a WAV file b) perform mid-term feature extract...
python
def mtFeatureExtractionToFile(fileName, midTermSize, midTermStep, shortTermSize, shortTermStep, outPutFile, storeStFeatures=False, storeToCSV=False, PLOT=False): """ This function is used as a wrapper to: a) read the content of a WAV file b) perform mid-term feature extract...
[ "def", "mtFeatureExtractionToFile", "(", "fileName", ",", "midTermSize", ",", "midTermStep", ",", "shortTermSize", ",", "shortTermStep", ",", "outPutFile", ",", "storeStFeatures", "=", "False", ",", "storeToCSV", "=", "False", ",", "PLOT", "=", "False", ")", ":"...
This function is used as a wrapper to: a) read the content of a WAV file b) perform mid-term feature extraction on that signal c) write the mid-term feature sequences to a numpy file
[ "This", "function", "is", "used", "as", "a", "wrapper", "to", ":", "a", ")", "read", "the", "content", "of", "a", "WAV", "file", "b", ")", "perform", "mid", "-", "term", "feature", "extraction", "on", "that", "signal", "c", ")", "write", "the", "mid"...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L889-L928
train
ricequant/rqalpha
rqalpha/model/base_account.py
BaseAccount.market_value
def market_value(self): """ [float] 市值 """ return sum(position.market_value for position in six.itervalues(self._positions))
python
def market_value(self): """ [float] 市值 """ return sum(position.market_value for position in six.itervalues(self._positions))
[ "def", "market_value", "(", "self", ")", ":", "return", "sum", "(", "position", ".", "market_value", "for", "position", "in", "six", ".", "itervalues", "(", "self", ".", "_positions", ")", ")" ]
[float] 市值
[ "[", "float", "]", "市值" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/base_account.py#L103-L107
train
ricequant/rqalpha
rqalpha/model/base_account.py
BaseAccount.transaction_cost
def transaction_cost(self): """ [float] 总费用 """ return sum(position.transaction_cost for position in six.itervalues(self._positions))
python
def transaction_cost(self): """ [float] 总费用 """ return sum(position.transaction_cost for position in six.itervalues(self._positions))
[ "def", "transaction_cost", "(", "self", ")", ":", "return", "sum", "(", "position", ".", "transaction_cost", "for", "position", "in", "six", ".", "itervalues", "(", "self", ".", "_positions", ")", ")" ]
[float] 总费用
[ "[", "float", "]", "总费用" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/base_account.py#L110-L114
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
buy_open
def buy_open(id_or_ins, amount, price=None, style=None): """ 买入开仓。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
python
def buy_open(id_or_ins, amount, price=None, style=None): """ 买入开仓。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
[ "def", "buy_open", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "return", "order", "(", "id_or_ins", ",", "amount", ",", "SIDE", ".", "BUY", ",", "POSITION_EFFECT", ".", "OPEN", ",", "cal_style", "(",...
买入开仓。 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :cla...
[ "买入开仓。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L208-L231
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
buy_close
def buy_close(id_or_ins, amount, price=None, style=None, close_today=False): """ 平卖仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要...
python
def buy_close(id_or_ins, amount, price=None, style=None, close_today=False): """ 平卖仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要...
[ "def", "buy_close", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ",", "close_today", "=", "False", ")", ":", "position_effect", "=", "POSITION_EFFECT", ".", "CLOSE_TODAY", "if", "close_today", "else", "POSITION_EFFECT"...
平卖仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :class...
[ "平卖仓" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L235-L261
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
sell_open
def sell_open(id_or_ins, amount, price=None, style=None): """ 卖出开仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
python
def sell_open(id_or_ins, amount, price=None, style=None): """ 卖出开仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
[ "def", "sell_open", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "return", "order", "(", "id_or_ins", ",", "amount", ",", "SIDE", ".", "SELL", ",", "POSITION_EFFECT", ".", "OPEN", ",", "cal_style", "(...
卖出开仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :clas...
[ "卖出开仓" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L265-L281
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
sell_close
def sell_close(id_or_ins, amount, price=None, style=None, close_today=False): """ 平买仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主...
python
def sell_close(id_or_ins, amount, price=None, style=None, close_today=False): """ 平买仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主...
[ "def", "sell_close", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ",", "close_today", "=", "False", ")", ":", "position_effect", "=", "POSITION_EFFECT", ".", "CLOSE_TODAY", "if", "close_today", "else", "POSITION_EFFECT...
平买仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :class...
[ "平买仓" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L285-L304
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
get_future_contracts
def get_future_contracts(underlying_symbol): """ 获取某一期货品种在策略当前日期的可交易合约order_book_id列表。按照到期月份,下标从小到大排列,返回列表中第一个合约对应的就是该品种的近月合约。 :param str underlying_symbol: 期货合约品种,例如沪深300股指期货为'IF' :return: list[`str`] :example: 获取某一天的主力合约代码(策略当前日期是20161201): .. code-block:: python [In...
python
def get_future_contracts(underlying_symbol): """ 获取某一期货品种在策略当前日期的可交易合约order_book_id列表。按照到期月份,下标从小到大排列,返回列表中第一个合约对应的就是该品种的近月合约。 :param str underlying_symbol: 期货合约品种,例如沪深300股指期货为'IF' :return: list[`str`] :example: 获取某一天的主力合约代码(策略当前日期是20161201): .. code-block:: python [In...
[ "def", "get_future_contracts", "(", "underlying_symbol", ")", ":", "env", "=", "Environment", ".", "get_instance", "(", ")", "return", "env", ".", "data_proxy", ".", "get_future_contracts", "(", "underlying_symbol", ",", "env", ".", "trading_dt", ")" ]
获取某一期货品种在策略当前日期的可交易合约order_book_id列表。按照到期月份,下标从小到大排列,返回列表中第一个合约对应的就是该品种的近月合约。 :param str underlying_symbol: 期货合约品种,例如沪深300股指期货为'IF' :return: list[`str`] :example: 获取某一天的主力合约代码(策略当前日期是20161201): .. code-block:: python [In] logger.info(get_future_contracts('IF')) ...
[ "获取某一期货品种在策略当前日期的可交易合约order_book_id列表。按照到期月份,下标从小到大排列,返回列表中第一个合约对应的就是该品种的近月合约。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L329-L349
train
ricequant/rqalpha
rqalpha/model/order.py
Order.quantity
def quantity(self): """ [int] 订单数量 """ if np.isnan(self._quantity): raise RuntimeError("Quantity of order {} is not supposed to be nan.".format(self.order_id)) return self._quantity
python
def quantity(self): """ [int] 订单数量 """ if np.isnan(self._quantity): raise RuntimeError("Quantity of order {} is not supposed to be nan.".format(self.order_id)) return self._quantity
[ "def", "quantity", "(", "self", ")", ":", "if", "np", ".", "isnan", "(", "self", ".", "_quantity", ")", ":", "raise", "RuntimeError", "(", "\"Quantity of order {} is not supposed to be nan.\"", ".", "format", "(", "self", ".", "order_id", ")", ")", "return", ...
[int] 订单数量
[ "[", "int", "]", "订单数量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/order.py#L156-L162
train
ricequant/rqalpha
rqalpha/model/order.py
Order.filled_quantity
def filled_quantity(self): """ [int] 订单已成交数量 """ if np.isnan(self._filled_quantity): raise RuntimeError("Filled quantity of order {} is not supposed to be nan.".format(self.order_id)) return self._filled_quantity
python
def filled_quantity(self): """ [int] 订单已成交数量 """ if np.isnan(self._filled_quantity): raise RuntimeError("Filled quantity of order {} is not supposed to be nan.".format(self.order_id)) return self._filled_quantity
[ "def", "filled_quantity", "(", "self", ")", ":", "if", "np", ".", "isnan", "(", "self", ".", "_filled_quantity", ")", ":", "raise", "RuntimeError", "(", "\"Filled quantity of order {} is not supposed to be nan.\"", ".", "format", "(", "self", ".", "order_id", ")",...
[int] 订单已成交数量
[ "[", "int", "]", "订单已成交数量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/order.py#L200-L206
train
ricequant/rqalpha
rqalpha/model/order.py
Order.frozen_price
def frozen_price(self): """ [float] 冻结价格 """ if np.isnan(self._frozen_price): raise RuntimeError("Frozen price of order {} is not supposed to be nan.".format(self.order_id)) return self._frozen_price
python
def frozen_price(self): """ [float] 冻结价格 """ if np.isnan(self._frozen_price): raise RuntimeError("Frozen price of order {} is not supposed to be nan.".format(self.order_id)) return self._frozen_price
[ "def", "frozen_price", "(", "self", ")", ":", "if", "np", ".", "isnan", "(", "self", ".", "_frozen_price", ")", ":", "raise", "RuntimeError", "(", "\"Frozen price of order {} is not supposed to be nan.\"", ".", "format", "(", "self", ".", "order_id", ")", ")", ...
[float] 冻结价格
[ "[", "float", "]", "冻结价格" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/order.py#L244-L250
train
ricequant/rqalpha
rqalpha/model/tick.py
TickObject.datetime
def datetime(self): """ [datetime.datetime] 当前快照数据的时间戳 """ try: dt = self._tick_dict['datetime'] except (KeyError, ValueError): return datetime.datetime.min else: if not isinstance(dt, datetime.datetime): if dt > 1000000...
python
def datetime(self): """ [datetime.datetime] 当前快照数据的时间戳 """ try: dt = self._tick_dict['datetime'] except (KeyError, ValueError): return datetime.datetime.min else: if not isinstance(dt, datetime.datetime): if dt > 1000000...
[ "def", "datetime", "(", "self", ")", ":", "try", ":", "dt", "=", "self", ".", "_tick_dict", "[", "'datetime'", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "return", "datetime", ".", "datetime", ".", "min", "else", ":", "if", "not", "...
[datetime.datetime] 当前快照数据的时间戳
[ "[", "datetime", ".", "datetime", "]", "当前快照数据的时间戳" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/tick.py#L44-L58
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py
StockPosition.value_percent
def value_percent(self): """ [float] 获得该持仓的实时市场价值在股票投资组合价值中所占比例,取值范围[0, 1] """ accounts = Environment.get_instance().portfolio.accounts if DEFAULT_ACCOUNT_TYPE.STOCK.name not in accounts: return 0 total_value = accounts[DEFAULT_ACCOUNT_TYPE.STOCK.name].total_v...
python
def value_percent(self): """ [float] 获得该持仓的实时市场价值在股票投资组合价值中所占比例,取值范围[0, 1] """ accounts = Environment.get_instance().portfolio.accounts if DEFAULT_ACCOUNT_TYPE.STOCK.name not in accounts: return 0 total_value = accounts[DEFAULT_ACCOUNT_TYPE.STOCK.name].total_v...
[ "def", "value_percent", "(", "self", ")", ":", "accounts", "=", "Environment", ".", "get_instance", "(", ")", ".", "portfolio", ".", "accounts", "if", "DEFAULT_ACCOUNT_TYPE", ".", "STOCK", ".", "name", "not", "in", "accounts", ":", "return", "0", "total_valu...
[float] 获得该持仓的实时市场价值在股票投资组合价值中所占比例,取值范围[0, 1]
[ "[", "float", "]", "获得该持仓的实时市场价值在股票投资组合价值中所占比例,取值范围", "[", "0", "1", "]" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py#L155-L163
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py
StockPosition.is_de_listed
def is_de_listed(self): """ 判断合约是否过期 """ env = Environment.get_instance() instrument = env.get_instrument(self._order_book_id) current_date = env.trading_dt if instrument.de_listed_date is not None: if instrument.de_listed_date.date() > env.config.bas...
python
def is_de_listed(self): """ 判断合约是否过期 """ env = Environment.get_instance() instrument = env.get_instrument(self._order_book_id) current_date = env.trading_dt if instrument.de_listed_date is not None: if instrument.de_listed_date.date() > env.config.bas...
[ "def", "is_de_listed", "(", "self", ")", ":", "env", "=", "Environment", ".", "get_instance", "(", ")", "instrument", "=", "env", ".", "get_instrument", "(", "self", ".", "_order_book_id", ")", "current_date", "=", "env", ".", "trading_dt", "if", "instrument...
判断合约是否过期
[ "判断合约是否过期" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py#L166-L179
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py
StockPosition.bought_value
def bought_value(self): """ [已弃用] """ user_system_log.warn(_(u"[abandon] {} is no longer valid.").format('stock_position.bought_value')) return self._quantity * self._avg_price
python
def bought_value(self): """ [已弃用] """ user_system_log.warn(_(u"[abandon] {} is no longer valid.").format('stock_position.bought_value')) return self._quantity * self._avg_price
[ "def", "bought_value", "(", "self", ")", ":", "user_system_log", ".", "warn", "(", "_", "(", "u\"[abandon] {} is no longer valid.\"", ")", ".", "format", "(", "'stock_position.bought_value'", ")", ")", "return", "self", ".", "_quantity", "*", "self", ".", "_avg_...
[已弃用]
[ "[", "已弃用", "]" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/stock_position.py#L200-L205
train
ricequant/rqalpha
rqalpha/model/booking.py
BookingPosition.trading_pnl
def trading_pnl(self): """ [float] 交易盈亏,策略在当前交易日产生的盈亏中来源于当日成交的部分 """ last_price = self._data_proxy.get_last_price(self._order_book_id) return self._contract_multiplier * (self._trade_quantity * last_price - self._trade_cost)
python
def trading_pnl(self): """ [float] 交易盈亏,策略在当前交易日产生的盈亏中来源于当日成交的部分 """ last_price = self._data_proxy.get_last_price(self._order_book_id) return self._contract_multiplier * (self._trade_quantity * last_price - self._trade_cost)
[ "def", "trading_pnl", "(", "self", ")", ":", "last_price", "=", "self", ".", "_data_proxy", ".", "get_last_price", "(", "self", ".", "_order_book_id", ")", "return", "self", ".", "_contract_multiplier", "*", "(", "self", ".", "_trade_quantity", "*", "last_pric...
[float] 交易盈亏,策略在当前交易日产生的盈亏中来源于当日成交的部分
[ "[", "float", "]", "交易盈亏,策略在当前交易日产生的盈亏中来源于当日成交的部分" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/booking.py#L223-L228
train
ricequant/rqalpha
rqalpha/model/booking.py
BookingPosition.position_pnl
def position_pnl(self): """ [float] 昨仓盈亏,策略在当前交易日产生的盈亏中来源于昨仓的部分 """ last_price = self._data_proxy.get_last_price(self._order_book_id) if self._direction == POSITION_DIRECTION.LONG: price_spread = last_price - self._last_price else: price_spread = s...
python
def position_pnl(self): """ [float] 昨仓盈亏,策略在当前交易日产生的盈亏中来源于昨仓的部分 """ last_price = self._data_proxy.get_last_price(self._order_book_id) if self._direction == POSITION_DIRECTION.LONG: price_spread = last_price - self._last_price else: price_spread = s...
[ "def", "position_pnl", "(", "self", ")", ":", "last_price", "=", "self", ".", "_data_proxy", ".", "get_last_price", "(", "self", ".", "_order_book_id", ")", "if", "self", ".", "_direction", "==", "POSITION_DIRECTION", ".", "LONG", ":", "price_spread", "=", "...
[float] 昨仓盈亏,策略在当前交易日产生的盈亏中来源于昨仓的部分
[ "[", "float", "]", "昨仓盈亏,策略在当前交易日产生的盈亏中来源于昨仓的部分" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/booking.py#L231-L241
train
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.register_event
def register_event(self): """ 注册事件 """ event_bus = Environment.get_instance().event_bus event_bus.prepend_listener(EVENT.PRE_BEFORE_TRADING, self._pre_before_trading) event_bus.prepend_listener(EVENT.POST_SETTLEMENT, self._post_settlement)
python
def register_event(self): """ 注册事件 """ event_bus = Environment.get_instance().event_bus event_bus.prepend_listener(EVENT.PRE_BEFORE_TRADING, self._pre_before_trading) event_bus.prepend_listener(EVENT.POST_SETTLEMENT, self._post_settlement)
[ "def", "register_event", "(", "self", ")", ":", "event_bus", "=", "Environment", ".", "get_instance", "(", ")", ".", "event_bus", "event_bus", ".", "prepend_listener", "(", "EVENT", ".", "PRE_BEFORE_TRADING", ",", "self", ".", "_pre_before_trading", ")", "event_...
注册事件
[ "注册事件" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L41-L47
train
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.unit_net_value
def unit_net_value(self): """ [float] 实时净值 """ if self._units == 0: return np.nan return self.total_value / self._units
python
def unit_net_value(self): """ [float] 实时净值 """ if self._units == 0: return np.nan return self.total_value / self._units
[ "def", "unit_net_value", "(", "self", ")", ":", "if", "self", ".", "_units", "==", "0", ":", "return", "np", ".", "nan", "return", "self", ".", "total_value", "/", "self", ".", "_units" ]
[float] 实时净值
[ "[", "float", "]", "实时净值" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L119-L125
train
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.daily_returns
def daily_returns(self): """ [float] 当前最新一天的日收益 """ if self._static_unit_net_value == 0: return np.nan return 0 if self._static_unit_net_value == 0 else self.unit_net_value / self._static_unit_net_value - 1
python
def daily_returns(self): """ [float] 当前最新一天的日收益 """ if self._static_unit_net_value == 0: return np.nan return 0 if self._static_unit_net_value == 0 else self.unit_net_value / self._static_unit_net_value - 1
[ "def", "daily_returns", "(", "self", ")", ":", "if", "self", ".", "_static_unit_net_value", "==", "0", ":", "return", "np", ".", "nan", "return", "0", "if", "self", ".", "_static_unit_net_value", "==", "0", "else", "self", ".", "unit_net_value", "/", "self...
[float] 当前最新一天的日收益
[ "[", "float", "]", "当前最新一天的日收益" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L139-L145
train
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.total_value
def total_value(self): """ [float]总权益 """ return sum(account.total_value for account in six.itervalues(self._accounts))
python
def total_value(self): """ [float]总权益 """ return sum(account.total_value for account in six.itervalues(self._accounts))
[ "def", "total_value", "(", "self", ")", ":", "return", "sum", "(", "account", ".", "total_value", "for", "account", "in", "six", ".", "itervalues", "(", "self", ".", "_accounts", ")", ")" ]
[float]总权益
[ "[", "float", "]", "总权益" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L167-L171
train
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.positions
def positions(self): """ [dict] 持仓 """ if self._mixed_positions is None: self._mixed_positions = MixedPositions(self._accounts) return self._mixed_positions
python
def positions(self): """ [dict] 持仓 """ if self._mixed_positions is None: self._mixed_positions = MixedPositions(self._accounts) return self._mixed_positions
[ "def", "positions", "(", "self", ")", ":", "if", "self", ".", "_mixed_positions", "is", "None", ":", "self", ".", "_mixed_positions", "=", "MixedPositions", "(", "self", ".", "_accounts", ")", "return", "self", ".", "_mixed_positions" ]
[dict] 持仓
[ "[", "dict", "]", "持仓" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L181-L187
train
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.cash
def cash(self): """ [float] 可用资金 """ return sum(account.cash for account in six.itervalues(self._accounts))
python
def cash(self): """ [float] 可用资金 """ return sum(account.cash for account in six.itervalues(self._accounts))
[ "def", "cash", "(", "self", ")", ":", "return", "sum", "(", "account", ".", "cash", "for", "account", "in", "six", ".", "itervalues", "(", "self", ".", "_accounts", ")", ")" ]
[float] 可用资金
[ "[", "float", "]", "可用资金" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L190-L194
train
ricequant/rqalpha
rqalpha/model/portfolio.py
Portfolio.market_value
def market_value(self): """ [float] 市值 """ return sum(account.market_value for account in six.itervalues(self._accounts))
python
def market_value(self): """ [float] 市值 """ return sum(account.market_value for account in six.itervalues(self._accounts))
[ "def", "market_value", "(", "self", ")", ":", "return", "sum", "(", "account", ".", "market_value", "for", "account", "in", "six", ".", "itervalues", "(", "self", ".", "_accounts", ")", ")" ]
[float] 市值
[ "[", "float", "]", "市值" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/portfolio.py#L205-L209
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_holding_pnl
def buy_holding_pnl(self): """ [float] 买方向当日持仓盈亏 """ return (self.last_price - self.buy_avg_holding_price) * self.buy_quantity * self.contract_multiplier
python
def buy_holding_pnl(self): """ [float] 买方向当日持仓盈亏 """ return (self.last_price - self.buy_avg_holding_price) * self.buy_quantity * self.contract_multiplier
[ "def", "buy_holding_pnl", "(", "self", ")", ":", "return", "(", "self", ".", "last_price", "-", "self", ".", "buy_avg_holding_price", ")", "*", "self", ".", "buy_quantity", "*", "self", ".", "contract_multiplier" ]
[float] 买方向当日持仓盈亏
[ "[", "float", "]", "买方向当日持仓盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L107-L111
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_holding_pnl
def sell_holding_pnl(self): """ [float] 卖方向当日持仓盈亏 """ return (self.sell_avg_holding_price - self.last_price) * self.sell_quantity * self.contract_multiplier
python
def sell_holding_pnl(self): """ [float] 卖方向当日持仓盈亏 """ return (self.sell_avg_holding_price - self.last_price) * self.sell_quantity * self.contract_multiplier
[ "def", "sell_holding_pnl", "(", "self", ")", ":", "return", "(", "self", ".", "sell_avg_holding_price", "-", "self", ".", "last_price", ")", "*", "self", ".", "sell_quantity", "*", "self", ".", "contract_multiplier" ]
[float] 卖方向当日持仓盈亏
[ "[", "float", "]", "卖方向当日持仓盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L114-L118
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_pnl
def buy_pnl(self): """ [float] 买方向累计盈亏 """ return (self.last_price - self._buy_avg_open_price) * self.buy_quantity * self.contract_multiplier
python
def buy_pnl(self): """ [float] 买方向累计盈亏 """ return (self.last_price - self._buy_avg_open_price) * self.buy_quantity * self.contract_multiplier
[ "def", "buy_pnl", "(", "self", ")", ":", "return", "(", "self", ".", "last_price", "-", "self", ".", "_buy_avg_open_price", ")", "*", "self", ".", "buy_quantity", "*", "self", ".", "contract_multiplier" ]
[float] 买方向累计盈亏
[ "[", "float", "]", "买方向累计盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L170-L174
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_pnl
def sell_pnl(self): """ [float] 卖方向累计盈亏 """ return (self._sell_avg_open_price - self.last_price) * self.sell_quantity * self.contract_multiplier
python
def sell_pnl(self): """ [float] 卖方向累计盈亏 """ return (self._sell_avg_open_price - self.last_price) * self.sell_quantity * self.contract_multiplier
[ "def", "sell_pnl", "(", "self", ")", ":", "return", "(", "self", ".", "_sell_avg_open_price", "-", "self", ".", "last_price", ")", "*", "self", ".", "sell_quantity", "*", "self", ".", "contract_multiplier" ]
[float] 卖方向累计盈亏
[ "[", "float", "]", "卖方向累计盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L177-L181
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_open_order_quantity
def buy_open_order_quantity(self): """ [int] 买方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.BUY and order.position_effect == POSITION_EFFECT.OPEN)
python
def buy_open_order_quantity(self): """ [int] 买方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.BUY and order.position_effect == POSITION_EFFECT.OPEN)
[ "def", "buy_open_order_quantity", "(", "self", ")", ":", "return", "sum", "(", "order", ".", "unfilled_quantity", "for", "order", "in", "self", ".", "open_orders", "if", "order", ".", "side", "==", "SIDE", ".", "BUY", "and", "order", ".", "position_effect", ...
[int] 买方向挂单量
[ "[", "int", "]", "买方向挂单量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L192-L197
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_open_order_quantity
def sell_open_order_quantity(self): """ [int] 卖方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.SELL and order.position_effect == POSITION_EFFECT.OPEN)
python
def sell_open_order_quantity(self): """ [int] 卖方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.SELL and order.position_effect == POSITION_EFFECT.OPEN)
[ "def", "sell_open_order_quantity", "(", "self", ")", ":", "return", "sum", "(", "order", ".", "unfilled_quantity", "for", "order", "in", "self", ".", "open_orders", "if", "order", ".", "side", "==", "SIDE", ".", "SELL", "and", "order", ".", "position_effect"...
[int] 卖方向挂单量
[ "[", "int", "]", "卖方向挂单量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L200-L205
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_close_order_quantity
def buy_close_order_quantity(self): """ [int] 买方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.BUY and order.position_effect in [POSITION_EFFECT.CLOSE, POSITION_EFFECT.CLOSE_TODAY])
python
def buy_close_order_quantity(self): """ [int] 买方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.BUY and order.position_effect in [POSITION_EFFECT.CLOSE, POSITION_EFFECT.CLOSE_TODAY])
[ "def", "buy_close_order_quantity", "(", "self", ")", ":", "return", "sum", "(", "order", ".", "unfilled_quantity", "for", "order", "in", "self", ".", "open_orders", "if", "order", ".", "side", "==", "SIDE", ".", "BUY", "and", "order", ".", "position_effect",...
[int] 买方向挂单量
[ "[", "int", "]", "买方向挂单量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L208-L213
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_close_order_quantity
def sell_close_order_quantity(self): """ [int] 卖方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.SELL and order.position_effect in [POSITION_EFFECT.CLOSE, POSITION_EFFECT.CLOSE_TODAY])
python
def sell_close_order_quantity(self): """ [int] 卖方向挂单量 """ return sum(order.unfilled_quantity for order in self.open_orders if order.side == SIDE.SELL and order.position_effect in [POSITION_EFFECT.CLOSE, POSITION_EFFECT.CLOSE_TODAY])
[ "def", "sell_close_order_quantity", "(", "self", ")", ":", "return", "sum", "(", "order", ".", "unfilled_quantity", "for", "order", "in", "self", ".", "open_orders", "if", "order", ".", "side", "==", "SIDE", ".", "SELL", "and", "order", ".", "position_effect...
[int] 卖方向挂单量
[ "[", "int", "]", "卖方向挂单量" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L216-L221
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.buy_avg_holding_price
def buy_avg_holding_price(self): """ [float] 买方向持仓均价 """ return 0 if self.buy_quantity == 0 else self._buy_holding_cost / self.buy_quantity / self.contract_multiplier
python
def buy_avg_holding_price(self): """ [float] 买方向持仓均价 """ return 0 if self.buy_quantity == 0 else self._buy_holding_cost / self.buy_quantity / self.contract_multiplier
[ "def", "buy_avg_holding_price", "(", "self", ")", ":", "return", "0", "if", "self", ".", "buy_quantity", "==", "0", "else", "self", ".", "_buy_holding_cost", "/", "self", ".", "buy_quantity", "/", "self", ".", "contract_multiplier" ]
[float] 买方向持仓均价
[ "[", "float", "]", "买方向持仓均价" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L322-L326
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.sell_avg_holding_price
def sell_avg_holding_price(self): """ [float] 卖方向持仓均价 """ return 0 if self.sell_quantity == 0 else self._sell_holding_cost / self.sell_quantity / self.contract_multiplier
python
def sell_avg_holding_price(self): """ [float] 卖方向持仓均价 """ return 0 if self.sell_quantity == 0 else self._sell_holding_cost / self.sell_quantity / self.contract_multiplier
[ "def", "sell_avg_holding_price", "(", "self", ")", ":", "return", "0", "if", "self", ".", "sell_quantity", "==", "0", "else", "self", ".", "_sell_holding_cost", "/", "self", ".", "sell_quantity", "/", "self", ".", "contract_multiplier" ]
[float] 卖方向持仓均价
[ "[", "float", "]", "卖方向持仓均价" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L329-L333
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.is_de_listed
def is_de_listed(self): """ 判断合约是否过期 """ instrument = Environment.get_instance().get_instrument(self._order_book_id) current_date = Environment.get_instance().trading_dt if instrument.de_listed_date is not None and current_date >= instrument.de_listed_date: re...
python
def is_de_listed(self): """ 判断合约是否过期 """ instrument = Environment.get_instance().get_instrument(self._order_book_id) current_date = Environment.get_instance().trading_dt if instrument.de_listed_date is not None and current_date >= instrument.de_listed_date: re...
[ "def", "is_de_listed", "(", "self", ")", ":", "instrument", "=", "Environment", ".", "get_instance", "(", ")", ".", "get_instrument", "(", "self", ".", "_order_book_id", ")", "current_date", "=", "Environment", ".", "get_instance", "(", ")", ".", "trading_dt",...
判断合约是否过期
[ "判断合约是否过期" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L372-L380
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition.apply_trade
def apply_trade(self, trade): """ 应用成交,并计算交易产生的现金变动。 开仓: delta_cash = -1 * margin = -1 * quantity * contract_multiplier * price * margin_rate 平仓: delta_cash = old_margin - margin + delta_realized_pnl = (sum of (cost_price * quantity) of c...
python
def apply_trade(self, trade): """ 应用成交,并计算交易产生的现金变动。 开仓: delta_cash = -1 * margin = -1 * quantity * contract_multiplier * price * margin_rate 平仓: delta_cash = old_margin - margin + delta_realized_pnl = (sum of (cost_price * quantity) of c...
[ "def", "apply_trade", "(", "self", ",", "trade", ")", ":", "# close_trade: delta_cash = old_margin - margin + delta_realized_pnl", "trade_quantity", "=", "trade", ".", "last_quantity", "if", "trade", ".", "side", "==", "SIDE", ".", "BUY", ":", "if", "trade", ".", ...
应用成交,并计算交易产生的现金变动。 开仓: delta_cash = -1 * margin = -1 * quantity * contract_multiplier * price * margin_rate 平仓: delta_cash = old_margin - margin + delta_realized_pnl = (sum of (cost_price * quantity) of closed trade) * contract_multiplier * margin_rate +...
[ "应用成交,并计算交易产生的现金变动。" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L411-L455
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
FuturePosition._close_holding
def _close_holding(self, trade): """ 应用平仓,并计算平仓盈亏 买平: delta_realized_pnl = sum of ((trade_price - cost_price)* quantity) of closed trades * contract_multiplier 卖平: delta_realized_pnl = sum of ((cost_price - trade_price)* quantity) of closed trades * contract_multiplier ...
python
def _close_holding(self, trade): """ 应用平仓,并计算平仓盈亏 买平: delta_realized_pnl = sum of ((trade_price - cost_price)* quantity) of closed trades * contract_multiplier 卖平: delta_realized_pnl = sum of ((cost_price - trade_price)* quantity) of closed trades * contract_multiplier ...
[ "def", "_close_holding", "(", "self", ",", "trade", ")", ":", "left_quantity", "=", "trade", ".", "last_quantity", "delta", "=", "0", "if", "trade", ".", "side", "==", "SIDE", ".", "BUY", ":", "# 先平昨仓", "if", "trade", ".", "position_effect", "==", "POSIT...
应用平仓,并计算平仓盈亏 买平: delta_realized_pnl = sum of ((trade_price - cost_price)* quantity) of closed trades * contract_multiplier 卖平: delta_realized_pnl = sum of ((cost_price - trade_price)* quantity) of closed trades * contract_multiplier :param trade: rqalpha.model.trade.Trade ...
[ "应用平仓,并计算平仓盈亏" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L457-L520
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.sector_code
def sector_code(self): """ [str] 板块缩写代码,全球通用标准定义(股票专用) """ try: return self.__dict__["sector_code"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'sector_code' ".format(self.order_book_i...
python
def sector_code(self): """ [str] 板块缩写代码,全球通用标准定义(股票专用) """ try: return self.__dict__["sector_code"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'sector_code' ".format(self.order_book_i...
[ "def", "sector_code", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"sector_code\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'sector_...
[str] 板块缩写代码,全球通用标准定义(股票专用)
[ "[", "str", "]", "板块缩写代码,全球通用标准定义(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L116-L125
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.sector_code_name
def sector_code_name(self): """ [str] 以当地语言为标准的板块代码名(股票专用) """ try: return self.__dict__["sector_code_name"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'sector_code_name' ".format(sel...
python
def sector_code_name(self): """ [str] 以当地语言为标准的板块代码名(股票专用) """ try: return self.__dict__["sector_code_name"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'sector_code_name' ".format(sel...
[ "def", "sector_code_name", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"sector_code_name\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribut...
[str] 以当地语言为标准的板块代码名(股票专用)
[ "[", "str", "]", "以当地语言为标准的板块代码名(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L128-L137
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.industry_code
def industry_code(self): """ [str] 国民经济行业分类代码,具体可参考“Industry列表” (股票专用) """ try: return self.__dict__["industry_code"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'industry_code' ".form...
python
def industry_code(self): """ [str] 国民经济行业分类代码,具体可参考“Industry列表” (股票专用) """ try: return self.__dict__["industry_code"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'industry_code' ".form...
[ "def", "industry_code", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"industry_code\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'ind...
[str] 国民经济行业分类代码,具体可参考“Industry列表” (股票专用)
[ "[", "str", "]", "国民经济行业分类代码,具体可参考“Industry列表”", "(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L140-L149
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.industry_name
def industry_name(self): """ [str] 国民经济行业分类名称(股票专用) """ try: return self.__dict__["industry_name"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'industry_name' ".format(self.order_book_...
python
def industry_name(self): """ [str] 国民经济行业分类名称(股票专用) """ try: return self.__dict__["industry_name"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'industry_name' ".format(self.order_book_...
[ "def", "industry_name", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"industry_name\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'ind...
[str] 国民经济行业分类名称(股票专用)
[ "[", "str", "]", "国民经济行业分类名称(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L152-L161
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.concept_names
def concept_names(self): """ [str] 概念股分类,例如:’铁路基建’,’基金重仓’等(股票专用) """ try: return self.__dict__["concept_names"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'concept_names' ".format(sel...
python
def concept_names(self): """ [str] 概念股分类,例如:’铁路基建’,’基金重仓’等(股票专用) """ try: return self.__dict__["concept_names"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'concept_names' ".format(sel...
[ "def", "concept_names", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"concept_names\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'con...
[str] 概念股分类,例如:’铁路基建’,’基金重仓’等(股票专用)
[ "[", "str", "]", "概念股分类,例如:’铁路基建’,’基金重仓’等(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L164-L173
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.board_type
def board_type(self): """ [str] 板块类别,’MainBoard’ - 主板,’GEM’ - 创业板(股票专用) """ try: return self.__dict__["board_type"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'board_type' ".format(se...
python
def board_type(self): """ [str] 板块类别,’MainBoard’ - 主板,’GEM’ - 创业板(股票专用) """ try: return self.__dict__["board_type"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'board_type' ".format(se...
[ "def", "board_type", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"board_type\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'board_typ...
[str] 板块类别,’MainBoard’ - 主板,’GEM’ - 创业板(股票专用)
[ "[", "str", "]", "板块类别,’MainBoard’", "-", "主板", "’GEM’", "-", "创业板(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L176-L185
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.status
def status(self): """ [str] 合约状态。’Active’ - 正常上市, ‘Delisted’ - 终止上市, ‘TemporarySuspended’ - 暂停上市, ‘PreIPO’ - 发行配售期间, ‘FailIPO’ - 发行失败(股票专用) """ try: return self.__dict__["status"] except (KeyError, ValueError): raise AttributeError( ...
python
def status(self): """ [str] 合约状态。’Active’ - 正常上市, ‘Delisted’ - 终止上市, ‘TemporarySuspended’ - 暂停上市, ‘PreIPO’ - 发行配售期间, ‘FailIPO’ - 发行失败(股票专用) """ try: return self.__dict__["status"] except (KeyError, ValueError): raise AttributeError( ...
[ "def", "status", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"status\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'status' \"", "....
[str] 合约状态。’Active’ - 正常上市, ‘Delisted’ - 终止上市, ‘TemporarySuspended’ - 暂停上市, ‘PreIPO’ - 发行配售期间, ‘FailIPO’ - 发行失败(股票专用)
[ "[", "str", "]", "合约状态。’Active’", "-", "正常上市", "‘Delisted’", "-", "终止上市", "‘TemporarySuspended’", "-", "暂停上市", "‘PreIPO’", "-", "发行配售期间", "‘FailIPO’", "-", "发行失败(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L188-L198
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.special_type
def special_type(self): """ [str] 特别处理状态。’Normal’ - 正常上市, ‘ST’ - ST处理, ‘StarST’ - *ST代表该股票正在接受退市警告, ‘PT’ - 代表该股票连续3年收入为负,将被暂停交易, ‘Other’ - 其他(股票专用) """ try: return self.__dict__["special_type"] except (KeyError, ValueError): raise AttributeError( ...
python
def special_type(self): """ [str] 特别处理状态。’Normal’ - 正常上市, ‘ST’ - ST处理, ‘StarST’ - *ST代表该股票正在接受退市警告, ‘PT’ - 代表该股票连续3年收入为负,将被暂停交易, ‘Other’ - 其他(股票专用) """ try: return self.__dict__["special_type"] except (KeyError, ValueError): raise AttributeError( ...
[ "def", "special_type", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"special_type\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'speci...
[str] 特别处理状态。’Normal’ - 正常上市, ‘ST’ - ST处理, ‘StarST’ - *ST代表该股票正在接受退市警告, ‘PT’ - 代表该股票连续3年收入为负,将被暂停交易, ‘Other’ - 其他(股票专用)
[ "[", "str", "]", "特别处理状态。’Normal’", "-", "正常上市", "‘ST’", "-", "ST处理", "‘StarST’", "-", "*", "ST代表该股票正在接受退市警告", "‘PT’", "-", "代表该股票连续3年收入为负,将被暂停交易", "‘Other’", "-", "其他(股票专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L201-L211
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.contract_multiplier
def contract_multiplier(self): """ [float] 合约乘数,例如沪深300股指期货的乘数为300.0(期货专用) """ try: return self.__dict__["contract_multiplier"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'contract_mu...
python
def contract_multiplier(self): """ [float] 合约乘数,例如沪深300股指期货的乘数为300.0(期货专用) """ try: return self.__dict__["contract_multiplier"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'contract_mu...
[ "def", "contract_multiplier", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"contract_multiplier\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no at...
[float] 合约乘数,例如沪深300股指期货的乘数为300.0(期货专用)
[ "[", "float", "]", "合约乘数,例如沪深300股指期货的乘数为300", ".", "0(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L214-L223
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.margin_rate
def margin_rate(self): """ [float] 合约最低保证金率(期货专用) """ try: return self.__dict__["margin_rate"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'margin_rate' ".format(self.order_book_id) ...
python
def margin_rate(self): """ [float] 合约最低保证金率(期货专用) """ try: return self.__dict__["margin_rate"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'margin_rate' ".format(self.order_book_id) ...
[ "def", "margin_rate", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"margin_rate\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'margin_...
[float] 合约最低保证金率(期货专用)
[ "[", "float", "]", "合约最低保证金率(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L226-L235
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.underlying_order_book_id
def underlying_order_book_id(self): """ [str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用) """ try: return self.__dict__["underlying_order_book_id"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={})...
python
def underlying_order_book_id(self): """ [str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用) """ try: return self.__dict__["underlying_order_book_id"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={})...
[ "def", "underlying_order_book_id", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"underlying_order_book_id\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={})...
[str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用)
[ "[", "str", "]", "合约标的代码,目前除股指期货", "(", "IH", "IF", "IC", ")", "之外的期货合约,这一字段全部为’null’(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L238-L247
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.underlying_symbol
def underlying_symbol(self): """ [str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用) """ try: return self.__dict__["underlying_symbol"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attrib...
python
def underlying_symbol(self): """ [str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用) """ try: return self.__dict__["underlying_symbol"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attrib...
[ "def", "underlying_symbol", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"underlying_symbol\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attrib...
[str] 合约标的代码,目前除股指期货(IH, IF, IC)之外的期货合约,这一字段全部为’null’(期货专用)
[ "[", "str", "]", "合约标的代码,目前除股指期货", "(", "IH", "IF", "IC", ")", "之外的期货合约,这一字段全部为’null’(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L250-L259
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.maturity_date
def maturity_date(self): """ [datetime] 期货到期日。主力连续合约与指数连续合约都为 datetime(2999, 12, 31)(期货专用) """ try: return self.__dict__["maturity_date"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'm...
python
def maturity_date(self): """ [datetime] 期货到期日。主力连续合约与指数连续合约都为 datetime(2999, 12, 31)(期货专用) """ try: return self.__dict__["maturity_date"] except (KeyError, ValueError): raise AttributeError( "Instrument(order_book_id={}) has no attribute 'm...
[ "def", "maturity_date", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"maturity_date\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attribute 'mat...
[datetime] 期货到期日。主力连续合约与指数连续合约都为 datetime(2999, 12, 31)(期货专用)
[ "[", "datetime", "]", "期货到期日。主力连续合约与指数连续合约都为", "datetime", "(", "2999", "12", "31", ")", "(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L262-L271
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.settlement_method
def settlement_method(self): """ [str] 交割方式,’CashSettlementRequired’ - 现金交割, ‘PhysicalSettlementRequired’ - 实物交割(期货专用) """ try: return self.__dict__["settlement_method"] except (KeyError, ValueError): raise AttributeError( "Instrument(order...
python
def settlement_method(self): """ [str] 交割方式,’CashSettlementRequired’ - 现金交割, ‘PhysicalSettlementRequired’ - 实物交割(期货专用) """ try: return self.__dict__["settlement_method"] except (KeyError, ValueError): raise AttributeError( "Instrument(order...
[ "def", "settlement_method", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__dict__", "[", "\"settlement_method\"", "]", "except", "(", "KeyError", ",", "ValueError", ")", ":", "raise", "AttributeError", "(", "\"Instrument(order_book_id={}) has no attrib...
[str] 交割方式,’CashSettlementRequired’ - 现金交割, ‘PhysicalSettlementRequired’ - 实物交割(期货专用)
[ "[", "str", "]", "交割方式,’CashSettlementRequired’", "-", "现金交割", "‘PhysicalSettlementRequired’", "-", "实物交割(期货专用)" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L274-L283
train
ricequant/rqalpha
rqalpha/model/instrument.py
Instrument.listing
def listing(self): """ [bool] 该合约当前日期是否在交易 """ now = Environment.get_instance().calendar_dt return self.listed_date <= now <= self.de_listed_date
python
def listing(self): """ [bool] 该合约当前日期是否在交易 """ now = Environment.get_instance().calendar_dt return self.listed_date <= now <= self.de_listed_date
[ "def", "listing", "(", "self", ")", ":", "now", "=", "Environment", ".", "get_instance", "(", ")", ".", "calendar_dt", "return", "self", ".", "listed_date", "<=", "now", "<=", "self", ".", "de_listed_date" ]
[bool] 该合约当前日期是否在交易
[ "[", "bool", "]", "该合约当前日期是否在交易" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/model/instrument.py#L286-L292
train