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
# save map as html: | |
saveWidget(map, "map.html") |
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
# creat map widget: | |
map <- leaflet() %>% addTiles() %>% | |
addCircleMarkers(lng = file_sub$lon, | |
lat = file_sub$lat, | |
color = pal(file_sub$hours), | |
popup = paste0(file_sub$dateTime, "<br/>", | |
round(file_sub$lon, 6), "<br/>", | |
round(file_sub$lat, 6))) %>% | |
addLegend(position = "topleft", pal = pal, values = file_sub$hours, title = "hours past<br/>midnight") | |
map |
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
# for each file obtain the EXIF codes and extract the coordinates | |
GPStags <- apply(array(file_info$file.name), 1, function(x) { | |
EXIF_code <- NULL | |
try (EXIF_code <- attr(GDALinfo(x), "mdata"), silent = T) | |
if (is.null(EXIF_code)) return(data.frame(lon = NA, lat = NA, dateTime = NA)) else return(get_EXIF_coordinate(EXIF_code)) | |
}) | |
#bind the results: | |
GPStags <- do.call(rbind, GPStags) | |
# store in the data.frame |
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
# required packages | |
require(rgdal) | |
require(leaflet) | |
require(htmlwidgets) | |
# select files for which geotags need to | |
# be extracted and store filenames in data.frame | |
file_info <- data.frame(file.name = choose.files(filters = Filters["jpeg",])) | |
# function to get a parameter value from EXIF code, |
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
# load the required packages | |
require(ProTrackR) | |
# set up a connection to 'cyberrid.mod': | |
con <- url("http://api.modarchive.org/downloads.php?moduleid=40293", "rb") | |
# download module: | |
mod <- read.module(con) | |
close(con) | |
rm(con) |
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
# select a sample: | |
plot_samp <- PTSample(mod, 25) | |
# generate power spectrum | |
spec <- powspec(waveform(plot_samp), | |
wintime = 0.1, | |
steptime = 0.005) | |
spec_cutoff <- quantile(log10(spec), 0.01) | |
spec[log10(spec) < spec_cutoff] <- 10^spec_cutoff |
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
# play all samples in the module at note "C-3" | |
playSample(mod) | |
# play chromatic scales of octaves 2 and 3 using the 23rd sample | |
data(period_table) | |
for (i_note in as.vector(outer(names(period_table)[-1:-2], | |
c(2:3), function(x, y) paste(x, y, sep = "")))) | |
{ | |
print(i_note) | |
playSample(PTSample(mod, 23), 0.1, T, i_note, 0.5) |
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
# required packages: | |
require(plot3D) | |
require(ProTrackR) | |
# Read the module 'elekfunk' from the Mod Archive: | |
con <- url("http://api.modarchive.org/downloads.php?moduleid=41528", "rb") | |
mod <- read.module(con) | |
close(con) | |
rm(con) |
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
################################# | |
# ball and stick model | |
################################# | |
# get bond info | |
bonds <- get.bonds(molfile) | |
bonds.atoms <- data.frame(do.call('rbind', lapply(bonds, function(x){ | |
atoms <- get.atoms(x) | |
start <- get.point3d(atoms[[1]]) | |
end <- get.point3d(atoms[[2]]) |
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
# simply plot the atoms as coloured spheres. | |
# multiply the Van der Waals radii with 0.75 | |
# to reduce overlap of atoms. | |
mapply(function(x, y, z, vdw, col){ | |
spheres3d(x, y, z, + vdw*0.75, col = col, add = T) | |
}, atom_dat$x, atom_dat$y, atom_dat$z, | |
atom_dat$vanderwaals, atom_dat$colour) | |
# Save as an interactive model on web page | |
writeWebGL() |