Repository Structure & Naming Conventions
Relevant source files
The following files were used as context for generating this wiki page:
The bme533 repository is organized as a collection of homework assignments, specifically identified by a directory naming convention that utilizes the prefix hw followed by an incremental assignment number. Each assignment directory contains the necessary source code for processing data and the associated data files required for analysis.
The repository primarily focuses on statistical data analysis using Python. The structure emphasizes a clear separation between logical implementation (Python scripts) and raw data (text and CSV files). This organization ensures that each assignment is self-contained with its specific inputs and logic.
Sources: hw1/p1.py, hw1/CHOLESTEROL.txt, hw1/WEIGHT.txt
Directory Organization
The project follows a modular structure where each top-level directory represents a distinct homework module. Within these modules, files are named according to their function—either as logic-bearing scripts or as data sources.
Module Naming and Content
Assignments are contained within folders like hw1. Inside these folders, the primary execution scripts are typically named p1.py or similar variations, suggesting a "Problem 1" or "Program 1" naming convention.
| Component | Convention | Description |
|---|---|---|
| Assignment Folders | hw{N} | Directories containing all files for a specific assignment (e.g., hw1). |
| Implementation Scripts | p{N}.py | Python files containing data processing and statistical logic. |
| Data Files | UPPERCASE.txt or data.csv | Files containing raw numerical data for processing. |
Sources: hw1/p1.py:1-6, hw1/CHOLESTEROL.txt, hw1/WEIGHT.txt
Naming Conventions for Code and Data
The repository utilizes specific naming patterns for both file names and internal code identifiers to maintain consistency across statistical analysis tasks.
File Naming
- Source Code: Files are lowercase and prefixed with 'p' followed by the problem number (e.g.,
p1.py). - Data Sources: Data files often use uppercase descriptive names for clarity, such as
CHOLESTEROL.txtandWEIGHT.txt.
Variable and Function Naming
The Python scripts employ a mix of descriptive function names and short variable names. Functions like open_file and compute_file use snake_case to describe their operations. Internal variables for statistical results are descriptive (e.g., mean, median, std).
The diagram shows the hierarchical relationship between homework directories and their internal scripts/data files.
Sources: hw1/p1.py:5-17, hw1/CHOLESTEROL.txt, hw1/WEIGHT.txt
Data Flow and Interaction
The interaction between files follows a pattern where the Python script acts as a processor for the data files located within the same directory. The data is loaded into the script, processed using statistical libraries, and the results are outputted to the console.
Execution Flow
- File Loading: The script calls a function (e.g.,
open_file) with the name of a local text or CSV file. - Data Extraction: Lines are stripped and converted to float values.
- Statistical Calculation: Using libraries like
numpyandstatistics, metrics are calculated. - Output: Calculated values (Mean, Median, Mode, etc.) are printed.
This sequence illustrates how implementation scripts interact with local data files to produce statistical output.
Sources: hw1/p1.py:6-55
Statistical Implementation Logic
The p1.py file serves as a template for the repository's data analysis approach. It defines a global data list that is populated by the open_file function. The compute_file function orchestrates the analysis by calling open_file and then executing several statistical operations.
Key Functions
open_file(file_name): Handles file I/O and data validation (skipping non-numeric values).compute_file(file_name): The main driver that triggers the loading and subsequent statistical calculations.
Calculated Metrics
| Metric | Library / Method |
|---|---|
| Mean | np.mean(data) |
| Median | np.median(data) |
| Mode | statistics.mode(data) |
| Range | np.ptp(data) |
| Standard Deviation | np.std(data) |
| Variance | np.var(data) |
| CV1 (Coefficient of Variation) | 3*(mean - median) / std |
| CV2 (Moment-based skewness) | sum([(x - mean) ** 3 for x in data]) / (len(data) * std ** 3) |
Sources: hw1/p1.py:18-53
Conclusion
The repository structure of bme533 is designed for educational or research-based statistical analysis, with a clear organizational focus on individual homework assignments. By maintaining consistent naming conventions for directories (hw{N}) and scripts (p{N}.py), and separating data from logic, the project provides a predictable environment for processing numerical datasets using Python's scientific computing stack.