@@ -111,8 +111,35 @@ def main():
111111 "cusum" : "Cumulative Sums: Kümülatif toplam testi, sapmaları tespit eder." ,
112112 "dft_spectral_advanced" : "DFT Spectral Advanced: Spektral analiz, frekans paternlerini arar." ,
113113 "diehard_3d_spheres" : "Diehard 3D Spheres: 3D küre testi (veri yetersizse hata verir)." ,
114- # Diğer testler için benzer açıklamalar ekleyin...
115- # (Tüm testler için eklemek ideal, ama örnek olarak birkaç tane)
114+ "diehard_birthday_spacings" : "Diehard Birthday Spacings: Doğum günü aralık testi." ,
115+ "diehard_overlapping_sums" : "Diehard Overlapping Sums: Çakışan toplamlar testi." ,
116+ "dotplot" : "Dotplot: Veri paternlerini görselleştirir." ,
117+ "ecb_detector" : "ECB Detector: ECB modunda şifreleme paternlerini arar." ,
118+ "fft_spectral" : "FFT Spectral: Frekans domain analizi." ,
119+ "frequency_pattern" : "Frequency Pattern: Frekans paternleri ve Vigenere anahtar uzunluğu tahmini." ,
120+ "hurst_exponent" : "Hurst Exponent: Uzun vadeli bağımlılık ölçüsü." ,
121+ "known_constants_search" : "Known Constants Search: Bilinen sabitleri arar." ,
122+ "linear_complexity" : "Linear Complexity: Lineer karmaşıklık testi." ,
123+ "longest_run_ones" : "Longest Run of Ones: En uzun 1'ler dizisi testi." ,
124+ "lstm_gru_anomaly" : "LSTM GRU Anomaly: Zaman serisi anomalileri tespit eder." ,
125+ "lz_complexity" : "LZ Complexity: Lempel-Ziv karmaşıklığı." ,
126+ "magic_detector" : "Magic Detector: Dosya tipi sihirli baytları arar." ,
127+ "maurers_universal" : "Maurer's Universal: Evrensel istatistik testi." ,
128+ "mutual_information" : "Mutual Information: Karşılıklı bilgi ölçüsü." ,
129+ "nist_dft_spectral" : "NIST DFT Spectral: NIST spektral testi." ,
130+ "non_overlapping_template_matching" : "Non-Overlapping Template: Çakışmayan şablon eşleştirme." ,
131+ "overlapping_template_matching" : "Overlapping Template: Çakışan şablon eşleştirme." ,
132+ "blocking" : "Blocking: Bloklama testi." ,
133+ "quickstat" : "Quickstat: Hızlı istatistik özeti." ,
134+ "pdf_structure" : "PDF Structure: PDF yapı analizi." ,
135+ "png_structure" : "PNG Structure: PNG yapı analizi." ,
136+ "random_excursions" : "Random Excursions: Rastgele gezinti testi." ,
137+ "random_excursions_variant" : "Random Excursions Variant: Gezinti varyantı." ,
138+ "runs" : "Runs: Runs testi, değişim sayısını kontrol eder." ,
139+ "serial" : "Serial: Seri korelasyon testi." ,
140+ "testu01_smallcrush" : "TestU01 SmallCrush: Küçük ezme test paketi." ,
141+ "transfer_entropy" : "Transfer Entropy: Bilgi transferi ölçüsü." ,
142+ "zip_structure" : "ZIP Structure: ZIP arşiv yapı analizi." ,
116143 },
117144 "column_explanations" : {
118145 "test_name" : "Test adı" ,
@@ -134,18 +161,111 @@ def main():
134161 }
135162 },
136163 "en" : {
137- # İngilizce karşılıklarını ekleyin...
138164 "main_title" : "🔬 PatternLab Analysis Platform" ,
139- # ... diğerleri
165+ "main_desc" : "This platform offers powerful statistical tests to analyze randomness patterns in your data. Upload a file or enter data directly and get a comprehensive analysis report." ,
166+ "results_title" : "📊 Analysis Results" ,
167+ "control_panel" : "⚙️ Control Panel" ,
168+ "file_tab" : "📁 File" ,
169+ "text_tab" : "✏️ Text" ,
170+ "file_label" : "Select File" ,
171+ "file_help" : "Limit 200MB per file • BIN, TXT, DAT" ,
172+ "text_label" : "Enter Data" ,
173+ "text_placeholder" : "Base64 encoded data or plain text..." ,
174+ "test_selection" : "🧪 Test Selection" ,
175+ "tests_label" : "Tests to Run" ,
176+ "tests_help" : "Select tests to run. Each test examines randomness from different angles. For example, monobit checks the balance of 0s and 1s." ,
177+ "all_tests" : "Select All Tests" ,
178+ "no_tests" : "Select No Tests" ,
179+ "transform_selection" : "🔄 Transform Selection" ,
180+ "transforms_label" : "Transforms to Apply" ,
181+ "transforms_help" : "Select transforms to apply. Transforms modify data to enhance test sensitivity, e.g., XOR to break encryption patterns." ,
182+ "all_transforms" : "Select All Transforms" ,
183+ "no_transforms" : "Select No Transforms" ,
184+ "analysis_settings" : "⚙️ Analysis Settings" ,
185+ "fdr_label" : "FDR Significance Level (q)" ,
186+ "fdr_help" : "FDR (False Discovery Rate) significance level. Lower value (e.g., 0.05) means stricter testing; p-value < q fails the test." ,
187+ "start_analysis" : "🚀 Start Analysis" ,
188+ "clear" : "🗑️ Clear" ,
189+ "analyzing" : "Analyzing..." ,
190+ "analysis_error" : "Analysis error: {error}" ,
191+ "scorecard" : "Scorecard" ,
192+ "findings" : "Findings" ,
193+ "select_result" : "Select a result" ,
194+ "selected_details" : "Selected Result Details" ,
195+ "visuals" : "Visuals" ,
196+ "visual_error" : "Could not display visual ({name}): {error}" ,
197+ "visual_format_error" : "Invalid visual format: {name}" ,
198+ "no_results" : "No analysis results or empty." ,
199+ "language" : "Language" ,
200+ "failed_tests" : "Failed Tests" ,
201+ "mean_effect_size" : "Mean Effect Size" ,
202+ "mean_effect_size_desc" : "Average effect sizes from tests (e.g., deviation measure). None if insufficient data or not calculated." ,
203+ "p_value_distribution" : "P-Value Distribution" ,
204+ "p_value_distribution_desc" : "Statistics of p-values (count, mean, median, etc.). In random data, p-values should be uniformly distributed." ,
205+ "total_tests" : "Total Tests" ,
206+ "fdr_q" : "FDR q" ,
207+ "skipped_tests" : "Skipped Tests" ,
208+ "skipped_tests_desc" : "Skipped tests: Insufficient data size or preconditions not met. Details in 'reason' column of results table." ,
209+ "run_tests" : "Run Tests" ,
140210 "test_explanations" : {
141211 "monobit" : "Monobit test: Checks the proportion of 0s and 1s. Should be approximately equal in random data." ,
142- # ... diğerleri
212+ "approximate_entropy" : "Approximate Entropy: Measures unpredictability. Low entropy indicates regular patterns." ,
213+ "autocorrelation" : "Autocorrelation: Computes lagged correlation. High values indicate periodicity." ,
214+ "autoencoder_anomaly" : "Autoencoder Anomaly: Detects anomalies using machine learning." ,
215+ "binary_matrix_rank" : "Binary Matrix Rank: Tests for linear dependencies in matrices." ,
216+ "block_frequency" : "Block Frequency: Tests frequency distribution in blocks." ,
217+ "classifier_labeler" : "Classifier Labeler: Labels data using a classifier." ,
218+ "conditional_entropy" : "Conditional Entropy: Measures dependencies." ,
219+ "cusum" : "Cumulative Sums: Detects deviations in cumulative sums." ,
220+ "dft_spectral_advanced" : "DFT Spectral Advanced: Spectral analysis for frequency patterns." ,
221+ "diehard_3d_spheres" : "Diehard 3D Spheres: 3D sphere test (errors if data insufficient)." ,
222+ "diehard_birthday_spacings" : "Diehard Birthday Spacings: Birthday spacing test." ,
223+ "diehard_overlapping_sums" : "Diehard Overlapping Sums: Overlapping sums test." ,
224+ "dotplot" : "Dotplot: Visualizes data patterns." ,
225+ "ecb_detector" : "ECB Detector: Searches for ECB mode encryption patterns." ,
226+ "fft_spectral" : "FFT Spectral: Frequency domain analysis." ,
227+ "frequency_pattern" : "Frequency Pattern: Frequency patterns and Vigenere key length estimation." ,
228+ "hurst_exponent" : "Hurst Exponent: Measures long-term dependencies." ,
229+ "known_constants_search" : "Known Constants Search: Searches for known constants." ,
230+ "linear_complexity" : "Linear Complexity: Linear complexity test." ,
231+ "longest_run_ones" : "Longest Run of Ones: Longest sequence of 1s test." ,
232+ "lstm_gru_anomaly" : "LSTM GRU Anomaly: Detects time series anomalies." ,
233+ "lz_complexity" : "LZ Complexity: Lempel-Ziv complexity." ,
234+ "magic_detector" : "Magic Detector: File type magic bytes search." ,
235+ "maurers_universal" : "Maurer's Universal: Universal statistical test." ,
236+ "mutual_information" : "Mutual Information: Mutual information measure." ,
237+ "nist_dft_spectral" : "NIST DFT Spectral: NIST spectral test." ,
238+ "non_overlapping_template_matching" : "Non-Overlapping Template: Non-overlapping template matching." ,
239+ "overlapping_template_matching" : "Overlapping Template: Overlapping template matching." ,
240+ "blocking" : "Blocking: Blocking test." ,
241+ "quickstat" : "Quickstat: Quick statistical summary." ,
242+ "pdf_structure" : "PDF Structure: PDF structure analysis." ,
243+ "png_structure" : "PNG Structure: PNG structure analysis." ,
244+ "random_excursions" : "Random Excursions: Random excursion test." ,
245+ "random_excursions_variant" : "Random Excursions Variant: Excursion variant." ,
246+ "runs" : "Runs: Runs test, checks number of changes." ,
247+ "serial" : "Serial: Serial correlation test." ,
248+ "testu01_smallcrush" : "TestU01 SmallCrush: Small crush test battery." ,
249+ "transfer_entropy" : "Transfer Entropy: Information transfer measure." ,
250+ "zip_structure" : "ZIP Structure: ZIP archive structure analysis." ,
143251 },
144252 "column_explanations" : {
145253 "test_name" : "Test name" ,
146254 "passed" : "Passed? (True: Randomness accepted)" ,
147255 "p_value" : "P-value: Low (<0.05) means non-random. None if test doesn't produce p-value (descriptive)." ,
148- # ... diğerleri
256+ "p_values" : "Sub p-values (for multi-subtests)." ,
257+ "effect_sizes" : "Effect size: Deviation measure." ,
258+ "flags" : "Additional flags." ,
259+ "z_score" : "Z-score: Deviation in standard deviations." ,
260+ "evidence" : "Evidence/extra details." ,
261+ "time_ms" : "Processing time (ms)." ,
262+ "bytes_processed" : "Processed bytes." ,
263+ "status" : "Status: completed, skipped, error." ,
264+ "fdr_rejected" : "Rejected by FDR?" ,
265+ "fdr_q" : "FDR threshold." ,
266+ "visuals" : "Visuals (if any)." ,
267+ "reason" : "Reason for skip or error (e.g., insufficient data)." ,
268+ "metrics" : "Additional metrics." ,
149269 }
150270 }
151271 }[st .session_state .language ]
@@ -202,9 +322,9 @@ def main():
202322 )
203323
204324 # Test açıklamaları için expander
205- with st .expander ("Test Açıklamaları" ):
325+ with st .expander ("Test Açıklamaları" if st . session_state . language == "tr" else "Test Explanations" ):
206326 for test in available_tests :
207- desc = lang ['test_explanations' ].get (test , "Açıklama yok." )
327+ desc = lang ['test_explanations' ].get (test , "Açıklama yok." if st . session_state . language == "tr" else "No description." )
208328 st .write (f"**{ test } **: { desc } " )
209329
210330 col1 , col2 = st .columns (2 )
@@ -322,14 +442,16 @@ def main():
322442 'fdr_rejected' , 'fdr_q' , 'visuals' , 'reason' , 'metrics'
323443 ]
324444 df = df .reindex (columns = expected_columns )
325- # Do not stringify metrics, let dataframe handle
445+ # Convert dict keys in metrics to str for Arrow compatibility
446+ if 'metrics' in df .columns :
447+ df ['metrics' ] = df ['metrics' ].apply (lambda d : {str (k ): v for k , v in d .items ()} if isinstance (d , dict ) else d )
326448 if 'p_value' in df .columns :
327449 def _p_style (v ):
328450 try :
329451 return 'background-color: red' if float (v ) < fdr_q else ''
330452 except Exception :
331453 return ''
332- styled = df .style .applymap (_p_style , subset = ['p_value' ])
454+ styled = df .style .map (_p_style , subset = ['p_value' ])
333455 st .dataframe (styled , column_config = {
334456 col : st .column_config .TextColumn (help = lang ['column_explanations' ].get (col , '' )) for col in expected_columns
335457 })
@@ -349,13 +471,13 @@ def _p_style(v):
349471
350472 # Test-specific explanation
351473 test_name = selected_result .get ('test_name' )
352- desc = lang ['test_explanations' ].get (test_name , "Açıklama yok." )
474+ desc = lang ['test_explanations' ].get (test_name , "Açıklama yok." if st . session_state . language == "tr" else "No description." )
353475 st .write (f"**Test Açıklaması**: { desc } " )
354476
355477 # If skipped or error, show reason
356478 status = selected_result .get ('status' )
357479 if status == 'skipped' or status == 'error' :
358- reason = selected_result .get ('reason' , 'Bilinmeyen neden' )
480+ reason = selected_result .get ('reason' , 'Bilinmeyen neden' if st . session_state . language == "tr" else 'Unknown reason' )
359481 st .warning (f"Bu test { status } oldu. Neden: { reason } " )
360482
361483 # Visuals if any
@@ -367,13 +489,18 @@ def _p_style(v):
367489 if 'data_base64' in vdata :
368490 try :
369491 mime = vdata .get ('mime' , 'image/svg+xml' )
370- img_data = base64 .b64decode (vdata ['data_base64' ])
371- st .image (img_data , caption = vname , use_column_width = True )
492+ base64_data = vdata ['data_base64' ]
493+ if mime == 'image/svg+xml' :
494+ # Display SVG using markdown
495+ st .markdown (f'<img src="data:image/svg+xml;base64,{ base64_data } " alt="{ vname } ">' , unsafe_allow_html = True )
496+ else :
497+ img_data = base64 .b64decode (base64_data )
498+ st .image (img_data , caption = vname , use_container_width = True )
372499 except Exception as e :
373500 st .error (lang ['visual_error' ].format (name = vname , error = str (e )))
374501 elif 'path' in vdata :
375502 try :
376- st .image (vdata ['path' ], caption = vname , use_column_width = True )
503+ st .image (vdata ['path' ], caption = vname , use_container_width = True )
377504 except Exception as e :
378505 st .error (lang ['visual_error' ].format (name = vname , error = str (e )))
379506 else :
0 commit comments