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
import sys | |
import requests | |
from bs4 import BeautifulSoup | |
from dataclasses import dataclass | |
from typing import List | |
SECTIONS_TO_SCRAPE = [ | |
"general", | |
"security", |
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
[ | |
{ | |
"State": "Alabama", | |
"Abbreviation": "AL", | |
"State Tax Rate": 0.04, | |
"State Tax Rank": 40, | |
"Local Tax Rate": 0.051, | |
"Combined Tax Rate": 0.091, | |
"Combined Rank": 5 | |
}, |
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
fig = plt.figure() | |
ax1 = fig.add_subplot(111) | |
ax1.errorbar(temp,mag,yerr=magstdev,fmt='o') | |
ax1.set_xscale("log") | |
ax1.set_yscale("log") | |
plt.show() |
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
def calculate_and_save_values(Msamp,Esamp,spin,num_analysis,index,temp,data_filename,corr_filename): | |
try: | |
M_mean = np.average(Msamp[-num_analysis:]) | |
E_mean = np.average(Esamp[-num_analysis:]) | |
M_std = np.std(Msamp[-num_analysis:]) | |
E_std = np.std(Esamp[-num_analysis:]) | |
M_std_array = [] |
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
correlation_lengths = [] | |
correlation_uncertainties = [] | |
for temp in temp_range: | |
# read corr file, extract values for each temp | |
# perform fit for values vs distance, extract correlation length and uncertainty | |
# append correlation length and uncertainty to arrays |
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
async.series({ | |
function(callback) { | |
//add function here | |
callback(); | |
}, | |
}, function(err, results) { | |
response.redirect(''); | |
}); |
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
router.get('/', function(req, res, next) { | |
if (req.query.id) { | |
asyncStuff.series([ | |
function(callback) { | |
moduleModel.getPageItems(req.query.id, function(Data) { | |
pageData = Data[0]; | |
console.log('task 1'); | |
callback(); | |
}); | |
}, |
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
router.get('/', function(req, res, next) { | |
if (req.query.id) { | |
asyncStuff.series([ | |
function(callback) { | |
moduleModel.getPageItems(req.query.id, function(Data) { | |
pageData = Data[0]; | |
console.log('task 1'); | |
callback(); | |
}); | |
}, |
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
reduceDTM <- function(dtm){ | |
term_tfidf <- | |
tapply(dtm$v/row_sums(dtm)[dtm$i], dtm$j, mean) * | |
log2(nDocs(dtm)/col_sums(dtm > 0)) | |
dtm <- dtm[,term_tfidf >= median(term_tfidf)] | |
dtm <- dtm[row_sums(dtm) > 0,] | |
return(dtm) | |
} |
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
#install.packages('tm') | |
library(tm) | |
#install.packages('slam') | |
library("slam") | |
#import data | |
alldata <- read.csv('stackexchange/20161215StatsPostsMerged.csv', header = TRUE, stringsAsFactors = FALSE) | |
#make corpus |
NewerOlder