-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1229c4b
commit ecd7c69
Showing
30 changed files
with
416 additions
and
96 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
using BSON: @save, @load | ||
using CSV | ||
using DataFrames | ||
using LinearAlgebra | ||
using PrettyTables | ||
using Printf | ||
using Serialization | ||
using Statistics | ||
using StatsPlots | ||
using Turing | ||
|
||
@enum Month mar apr may jul jul2 aug1 aug2 sep oct nov | ||
|
||
@enum Pollster begin | ||
ag | ||
aj | ||
am | ||
bi2 | ||
bi3 | ||
bl2 | ||
bl3 | ||
cb2 | ||
cb3 | ||
cj | ||
cn2 | ||
cn3 | ||
ea | ||
ec2 | ||
ec3 | ||
ep | ||
eu | ||
fm2 | ||
fm3 | ||
fo2 | ||
fo3 | ||
hi2 | ||
hi3 | ||
hp | ||
ia | ||
ma2 | ||
ma3 | ||
mi2 | ||
mi3 | ||
mq | ||
mr2 | ||
mr3 | ||
ny2 | ||
ns | ||
pp | ||
ny | ||
qi2 | ||
qi3 | ||
rr | ||
si2 | ||
si3 | ||
sp2 | ||
sp3 | ||
su2 | ||
su3 | ||
tr | ||
wa2 | ||
wa3 | ||
ws | ||
wsl | ||
wss | ||
yg | ||
end | ||
|
||
@enum State PA GA NC MI AZ WI NV | ||
|
||
struct Poll | ||
biden_support::Float64 | ||
trump_support::Float64 | ||
sample_size::Int64 | ||
end | ||
|
||
|
||
@load "../objs/jul2_polls.bson" months | ||
|
||
months[aug1][AZ][ny2] = [Poll(49,45,677)] | ||
months[aug1][AZ][tr] = [Poll(47,48,1000)] | ||
months[aug1][GA][ny2] = [Poll(44,51,661)] | ||
months[aug1][MI][tr] = [Poll(49,47,800)] | ||
months[aug1][NC][cj] = [Poll(47,44,600)] | ||
months[aug1][NV][tr] = [Poll(45,49,1000)] | ||
months[aug1][NV][ny2] = [Poll(42,45,677)] | ||
months[aug1][PA][ec2] = [Poll(47,47,1000)] | ||
months[aug1][PA][tr] = [Poll(44,46,1000)] | ||
months[aug1][PA][qi2] = [Poll(48,45,1738)] | ||
months[aug1][WI][tr] = [Poll(48,49,800)] | ||
|
||
|
||
|
||
|
||
# needs to be done manually rather than with include() | ||
#@save "../objs/aug1_polls.bson" months | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
@enum State PA GA NC MI AZ WI NV | ||
@enum Month mar apr may jun jul jul2 aug sep oct | ||
# @enum State PA GA NC MI AZ WI NV | ||
# @enum Month mar apr may jun jul jul2 aug1 aug2 sep oct | ||
|
||
|
||
STATE = State | ||
prior_month = "jul" | ||
mon = jul2 | ||
MON = "jul2" | ||
Mon = "jul2" | ||
st = "AZ" | ||
ST = AZ | ||
prior_month = "jul2" | ||
mon = aug1 | ||
MON = "aug1" | ||
Mon = "aug1" | ||
st = "PA" | ||
ST = PA | ||
|
||
#include("polls_head.jl") | ||
prior_poll = BSON.load("../objs/"*"$st"*"_"*"$prior_month"*"_p_sample.bson") | ||
@load "../objs/"*"$MON"*"_polls.bson" months | ||
margin = first(margins[margins.st .== st, :pct]) | ||
|
||
current_month = remove_empties(months[mon]) | ||
# | ||
# include("polls_foot.jl") | ||
|
||
include("polls_foot.jl") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
# Directory containing .jl files | ||
directory="/Users/ro/projects/SwingWatch/_assets/scripts" | ||
|
||
# Output file to store extracted lines | ||
output_file="output_file.txt" | ||
|
||
# Check if the directory exists | ||
if [ ! -d "$directory" ]; then | ||
echo "Directory does not exist: $directory" | ||
exit 1 | ||
fi | ||
|
||
# Empty the output file if it already exists | ||
> "$output_file" | ||
|
||
# Function to extract lines from a file | ||
extract_functions() { | ||
local file="$1" | ||
local in_function=0 | ||
while IFS= read -r line; do | ||
if [[ $line =~ ^function ]]; then | ||
in_function=1 | ||
echo "$line" >> "$output_file" | ||
elif [[ $in_function -eq 1 && $line =~ end$ ]]; then | ||
echo "$line" >> "$output_file" | ||
echo "" >> "$output_file" # Add a newline for readability | ||
in_function=0 | ||
elif [[ $in_function -eq 1 ]]; then | ||
echo "$line" >> "$output_file" | ||
fi | ||
done < "$file" | ||
} | ||
|
||
# Export the function to be available in subshells | ||
export -f extract_functions | ||
|
||
# Find .jl files and process each one | ||
find "$directory" -type f -name '*.jl' -exec bash -c 'extract_functions "$0"' {} \; | ||
|
||
echo "Extraction complete. Output stored in: $output_file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.