This file contains hidden or 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
| with table_stats as ( | |
| select psut.relname, | |
| psut.n_live_tup, | |
| 1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio | |
| from pg_stat_user_tables psut | |
| order by psut.n_live_tup desc | |
| ), | |
| table_io as ( | |
| select psiut.relname, | |
| sum(psiut.heap_blks_read) as table_page_read, |
This file contains hidden or 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
| #converts csv file to oxcal code | |
| #csv format: | |
| #site_id;site_name;lab_no;meas_age;meas_age_std; | |
| import csv | |
| datafile = open('./daty.csv', encoding='utf8') | |
| myreader = csv.reader(datafile,delimiter=';') | |
| firstline = True | |
| with open('./out.oxcal', 'w') as f: | |
| print('Plot()\n{', file=f) | |
| for row in myreader: |
This file contains hidden or 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
| # read data in, three columns Name = lab code, Date = radiocarbon age, Uncertainty = error | |
| dates <- read.csv('F:/My Documents/My UW/Research/1308 Sulawesi/Dates/TalimbueDatesForOxcal-2.csv', stringsAsFactors = FALSE) | |
| # construct OxCal format | |
| oxcal_format <- paste0('R_Date(\"', gsub("^\\s+|\\s+$", "", dates$Name), '\",', dates$Date, ',', dates$Uncertainty, ');') | |
| # inspect | |
| cat(oxcal_format) | |
| # write formatted dates to text file | |
| write.table(oxcal_format, file = 'oxcal_format.txt', row.names = FALSE, col.names = FALSE, quote = FALSE) |